Module: Roda::RodaPlugins::Hooks::InstanceMethods

Defined in:
lib/roda/plugins/hooks.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Before routing, execute the before hooks, and execute the after hooks before returning.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/roda/plugins/hooks.rb', line 72

def call
  if b = opts[:before_hook]
    instance_exec(&b)
  end

  res = super
ensure
  if b = opts[:after_hook]
    instance_exec(res, &b)
  end
end