summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/zorglub/node.rb10
-rw-r--r--spec/spec_helper.rb3
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index aed6376..5eb2b85 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -116,12 +116,13 @@ module Zorglub
#
def feed!
Node.call_before_hooks self
+ state :meth
@content = self.send @action[:method], *@action[:args]
e, v, l = Config.engine_proc(@action[:engine]), view, layout
# TODO compile and cache
- @action[:mode]=:view
+ state :view
@content = e.call v, self if e and File.exists? v
- @action[:mode]=:layout
+ state :layout
@content = e.call l, self if e and File.exists? l
Node.call_after_hooks self
@content
@@ -138,6 +139,11 @@ module Zorglub
"You are being redirected, please follow this link to: <a href='#{target}'>#{target}</a>!"
end
#
+ def state state=nil
+ @action[:state] = state unless state.nil?
+ @action[:state]
+ end
+ #
def engine engine=nil
@action[:engine] = engine unless engine.nil? or engine.empty?
@action[:engine]
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 96d224f..6509357 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -14,8 +14,7 @@ require 'zorglub'
#
HASH_PROC = Proc.new { |path,obj| {:path=>path,:layout=>obj.layout,:view=>obj.view,:args=>obj.args}.to_yaml }
RENDER_PROC = Proc.new { |path,obj|
- m = obj.action[:mode]
- case m
+ case obj.state
when :layout
"layout_start #{obj.content} layout_end"
when :view