From 8d358b40bdbdc6fed6870e82a28d6043d59ca74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 16 Jan 2013 21:21:42 +0100 Subject: Node: replace state method by @state --- lib/zorglub/node.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index be035c6..9572503 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -254,7 +254,7 @@ module Zorglub # end # - attr_reader :request, :response, :content, :mime + attr_reader :request, :response, :content, :mime, :state # def initialize env, options @env = env @@ -265,11 +265,6 @@ module Zorglub self.class.cli_vals.each do |s,v| cli_val s, *v end end # - def state state=nil - @options[:state] = state unless state.nil? - @options[:state] - end - # def realize! catch(:stop_realize) { feed! @@ -281,9 +276,9 @@ module Zorglub end # def feed! - state :pre_cb + @state = :pre_cb self.class.call_before_hooks self - state :meth + @state = :meth @content = self.send @options[:method], *@options[:args] static_path = static if static_path.nil? @@ -291,9 +286,9 @@ module Zorglub else static_page! static_path end - state :post_cb + @state = :post_cb self.class.call_after_hooks self - state :finished + @state = :finished return @content, @mime end # @@ -317,10 +312,10 @@ module Zorglub v, l, debug = view, layout, app.opt(:debug) puts " * "+(File.exists?(l) ? 'use layout' : 'not found layout')+" : "+l if debug puts " * "+(File.exists?(v) ? 'use view ' : 'not found view ')+" : "+v if debug - state (@options[:layout].nil? ? :partial : :view) + @state = (@options[:layout].nil? ? :partial : :view) @content, mime = e.call v, self if e and File.exists? v @mime = mime unless mime.nil? - state :layout + @state = :layout @content, mime = e.call l, self if e and File.exists? l @mime = mime unless mime.nil? end -- cgit v1.1-2-g2b99