Module: Roda::RodaPlugins::Hooks::InstanceMethods
- Defined in:
- lib/roda/plugins/hooks.rb
Instance Method Summary collapse
-
#call(&block) ⇒ Object
Before routing, execute the before hooks, and execute the after hooks before returning.
Instance Method Details
#call(&block) ⇒ Object
Before routing, execute the before hooks, and execute the after hooks before returning.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/roda/plugins/hooks.rb', line 75 def call(&block) res = super do |r| if b = opts[:before_hook] instance_exec(&b) end instance_exec(r, &block) end ensure if b = opts[:after_hook] instance_exec(res, &b) end end |