From 7eb6a22e5549d25b95292c23498bd07f44c18fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 5 Jan 2012 23:09:50 +0100 Subject: Node: static, write mime in front of content to speed up data retrieval --- lib/zorglub/node.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 850cffd..d38862c 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -141,10 +141,10 @@ module Zorglub compile! Dir.mkdir Config.static_base_path Dir.mkdir File.dirname path - File.open(path, 'w') {|f| f.write(@content); f.write("\n@mime:"+@mime) } + File.open(path, 'w') {|f| f.write("@mime:"+@mime+"\n"); f.write(@content); } else content = File.open(path, 'r') {|f| f.read } - @content = content.sub /\n@mime:(.*)$/,'' + @content = content.sub /^@mime:(.*)\n/,'' @mime = $1 end end -- cgit v1.1-2-g2b99