summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-02-01 10:59:17 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-02-01 10:59:17 +0100
commite02cbcfae357acd51811b9ee0ddb353b7b4bb48c (patch)
treecbf08138aed507d29d61c1220a8e010d894ea97d /lib
parent8bbadf7b348a41855c557b2bf923b72851c83b98 (diff)
downloadzorglub-e02cbcfae357acd51811b9ee0ddb353b7b4bb48c.zip
zorglub-e02cbcfae357acd51811b9ee0ddb353b7b4bb48c.tar.gz
Node#partial: add first param env, allow by passing hooks
Diffstat (limited to 'lib')
-rw-r--r--lib/zorglub/node.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index d22c1c9..d4057db 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -228,10 +228,10 @@ module Zorglub
node.realize!
end
#
- def partial meth, *args
- node = self.new nil, meth.to_s, args, true
+ def partial env, meth, *args
+ node = self.new env, meth.to_s, args, true
return error_404 node if not node.respond_to? meth
- node.feed!
+ node.feed! env[:no_hooks]
node.content
end
#
@@ -274,9 +274,9 @@ module Zorglub
}
end
#
- def feed!
+ def feed! no_hooks=false
@state = :pre_cb
- self.class.call_before_hooks self
+ self.class.call_before_hooks self unless no_hooks
@state = :meth
@content = self.send @meth, *@args
static_path = static
@@ -286,7 +286,7 @@ module Zorglub
static_page! static_path
end
@state = :post_cb
- self.class.call_after_hooks self
+ self.class.call_after_hooks self unless no_hooks
@state = :finished
return @content, @mime
end