diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-01-16 22:02:18 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-01-16 22:02:18 +0100 |
commit | d3a936404bb375a7d79f4eafdc24c9cc4837e1db (patch) | |
tree | e6f00a1125f72b8dcd5192112cc452d8520bf428 /lib | |
parent | c5bfb744162ae0f90c66f1af629655a4d37455be (diff) | |
download | zorglub-d3a936404bb375a7d79f4eafdc24c9cc4837e1db.zip zorglub-d3a936404bb375a7d79f4eafdc24c9cc4837e1db.tar.gz |
replace @options[:layout] with @layout
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zorglub/node.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index c52649b..64e7144 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -66,12 +66,12 @@ module Zorglub end # def layout! layout - @options[:layout] = layout + @layout = layout end # def layout - return '' if @options[:layout].nil? - File.join(self.class.layout_base_path, @options[:layout])+ext + return nil if @layout.nil? + File.join(self.class.layout_base_path, @layout)+ext end # def view! view @@ -227,13 +227,13 @@ module Zorglub meth, *args = env['PATH_INFO'].sub(/^\//,'').split(/\//) meth||= 'index' puts "=> #{meth}(#{args.join ','})" if app.opt :debug - node = self.new env, {:layout=>layout,:view=>r(meth),:method=>meth,:args=>args} + node = self.new env, {:view=>r(meth),:method=>meth,:args=>args} return error_404 node if not node.respond_to? meth node.realize! end # def partial meth, *args - node = self.new nil, {:layout=>nil,:view=>r(meth),:method=>meth.to_s,:args=>args} + node = self.new nil, {:partial=>true,:view=>r(meth),:method=>meth.to_s,:args=>args} return error_404 node if not node.respond_to? meth node.feed! node.content @@ -259,6 +259,7 @@ module Zorglub @response = Rack::Response.new @cli_vals ={} @engine = self.class.engine + @layout = ( options[:partial] ? nil : self.class.layout ) @static = self.class.static self.class.cli_vals.each do |s,v| cli_val s, *v end end @@ -308,13 +309,13 @@ module Zorglub def compile_page! e, @options[:ext] = app.engine_proc_ext @engine, @options[:ext] v, l, debug = view, layout, app.opt(:debug) - puts " * "+(File.exists?(l) ? 'use layout' : 'not found layout')+" : "+l if debug + puts " * "+((l and File.exists?(l)) ? 'use layout' : 'not found layout')+" : "+(l ? l : '') if debug puts " * "+(File.exists?(v) ? 'use view ' : 'not found view ')+" : "+v if debug - @state = (@options[:layout].nil? ? :partial : :view) + @state = (@options[:partial] ? :partial : :view) @content, mime = e.call v, self if e and File.exists? v @mime = mime unless mime.nil? @state = :layout - @content, mime = e.call l, self if e and File.exists? l + @content, mime = e.call l, self if e and l and File.exists? l @mime = mime unless mime.nil? end # |