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
::ActiveSupport::Callbacks
- Attributes & Methods
- .__callbacks rw
- #__callbacks readonly
- .__callbacks? ⇒ Boolean rw
- #__callbacks? ⇒ Boolean readonly
Class Method Summary
::ActiveSupport::DescendantsTracker
- self
descendants | See additional method definition at line 104. |
subclasses | See additional method definition at line 100. |
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 22
def initialize(app) @app = app end
Class Attribute Details
.__callbacks (rw)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
.__callbacks? ⇒ Boolean
(rw)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
Class Method Details
.after(*args, &block)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 17
def after(*args, &block) set_callback(:call, :after, *args, &block) end
.before(*args, &block)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 13
def before(*args, &block) set_callback(:call, :before, *args, &block) end
Instance Attribute Details
#__callbacks (readonly)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
#__callbacks? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
Instance Method Details
#call(env)
[ GitHub ]# File 'actionpack/lib/action_dispatch/middleware/callbacks.rb', line 26
def call(env) error = nil result = run_callbacks :call do @app.call(env) rescue => error end raise error if error result end