Class: ActionDispatch::Callbacks
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: | |
| Instance Chain: | |
| Inherits: | Object | 
| Defined in: | actionpack/lib/action_dispatch/middleware/callbacks.rb | 
Overview
Provides callbacks to be executed before and after dispatching the request.
Constant Summary
::ActiveSupport::Callbacks - Included
Class Method Summary
::ActiveSupport::DescendantsTracker - self
| clear, descendants, direct_descendants, | |
| store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. | 
Instance Method Summary
::ActiveSupport::Callbacks - Included
| #run_callbacks | Runs the callbacks for the given event. | 
Constructor Details
    .new(app)  ⇒ Callbacks 
  
# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 21
def initialize(app) @app = app end
Class Method Details
.after(*args, &block)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 16
def after(*args, &block) set_callback(:call, :after, *args, &block) end
.before(*args, &block)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 12
def before(*args, &block) set_callback(:call, :before, *args, &block) end
Instance Method Details
#call(env)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 25
def call(env) error = nil result = run_callbacks :call do begin @app.call(env) rescue => error end end raise error if error result end
#to_cleanup
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 10
delegate :to_prepare, :to_cleanup, :to => "ActionDispatch::Reloader"
#to_prepare
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 10
delegate :to_prepare, :to_cleanup, :to => "ActionDispatch::Reloader"