class ActionDispatch::Callbacks
Provides callbacks to be executed before and after dispatching the request.
Public Class Methods
after(*args, &block)
click to toggle source
# File lib/action_dispatch/middleware/callbacks.rb, line 15 def after(*args, &block) set_callback(:call, :after, *args, &block) end
before(*args, &block)
click to toggle source
# File lib/action_dispatch/middleware/callbacks.rb, line 11 def before(*args, &block) set_callback(:call, :before, *args, &block) end
new(app)
click to toggle source
# File lib/action_dispatch/middleware/callbacks.rb, line 20 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/action_dispatch/middleware/callbacks.rb, line 24 def call(env) error = nil result = run_callbacks :call do @app.call(env) rescue => error end raise error if error result end