diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-01-16 22:20:38 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-01-16 22:20:38 +0100 |
commit | 8b1bf6ea29a358332a0c90f07f9aa789b0a5645c (patch) | |
tree | 71e40455cbbcaef121b1377e4f23b482970514af /lib | |
parent | 284f69a8cec290481b6015d51f837ebb6b945da5 (diff) | |
download | zorglub-8b1bf6ea29a358332a0c90f07f9aa789b0a5645c.zip zorglub-8b1bf6ea29a358332a0c90f07f9aa789b0a5645c.tar.gz |
cache instance :debug lookup in @debug
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zorglub/node.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 4328a66..e204326 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -258,6 +258,7 @@ module Zorglub @request = Rack::Request.new env @response = Rack::Response.new @cli_vals ={} + @debug = app.opt :debug @engine = self.class.engine @layout = ( options[:partial] ? nil : self.class.layout ) @view = r(options[:method]) @@ -298,9 +299,9 @@ module Zorglub Dir.mkdir app.static_base_path Dir.mkdir File.dirname path File.open(path, 'w') {|f| f.write("@mime:"+@mime+"\n"); f.write(@content); } - puts " * cache file created : #{path}" if app.opt :debug + puts " * cache file created : #{path}" if @debug else - puts " * use cache file : #{path}" if app.opt :debug + puts " * use cache file : #{path}" if @debug content = File.open(path, 'r') {|f| f.read } @content = content.sub /^@mime:(.*)\n/,'' @mime = $1 @@ -309,9 +310,12 @@ module Zorglub # def compile_page! e, @options[:ext] = app.engine_proc_ext @engine, @options[:ext] - v, l, debug = view, layout, app.opt(:debug) - puts " * "+((l and File.exists?(l)) ? 'use layout' : 'not found layout')+" : "+(l ? l : '') if debug - puts " * "+((v and File.exists?(v)) ? 'use view ' : 'not found view ')+" : "+(v ? v : '') if debug + v, l = view, layout + if @debug + puts " * "+(e ? 'use engine' : 'no engine ')+" : "+(e ? e.to_s : '') + puts " * "+((l and File.exists?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '') + puts " * "+((v and File.exists?(v)) ? 'use view ' : 'no view ')+" : "+(v ? v : '') + end @state = (@options[:partial] ? :partial : :view) @content, mime = e.call v, self if e and v and File.exists? v @mime = mime unless mime.nil? |