Method: Roda::RodaPlugins::Hooks::ClassMethods#after
- Defined in:
- lib/roda/plugins/hooks.rb
#after(&block) ⇒ Object
Add an after hook. If there is already an after hook defined, use a proc that instance_execs the existing after proc and then instance_execs the given after proc, so that the given after proc always executes after the previous one.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/roda/plugins/hooks.rb', line 42 def after(&block) opts[:after_hook] = if b = opts[:after_hook] proc do |res| instance_exec(res, &b) instance_exec(res, &block) end else block end end |