Action Dispatch MiddlewareStack
Read more about Rails middleware stack in the guides.
Namespace
- CLASS ActionDispatch::MiddlewareStack::InstrumentationProxy
- CLASS ActionDispatch::MiddlewareStack::Middleware
Methods
- #
- B
- D
- E
- I
- L
- M
- N
- S
- U
Included Modules
Attributes
[RW] | middlewares |
Class Public methods
new(*args) Link
Instance Public methods
[](i) Link
build(app = nil, &block) Link
# File actionpack/lib/action_dispatch/middleware/stack.rb, line 165 def build(app = nil, &block) instrumenting = ActiveSupport::Notifications.notifier.listening?(InstrumentationProxy::EVENT_NAME) middlewares.freeze.reverse.inject(app || block) do |a, e| if instrumenting e.build_instrumented(a) else e.build(a) end end end
delete(target) Link
Deletes a middleware from the middleware stack.
Returns the array of middlewares not including the deleted item, or returns nil if the target is not found.
delete!(target) Link
Deletes a middleware from the middleware stack.
Returns the array of middlewares not including the deleted item, or raises RuntimeError
if the target is not found.
each(&block) Link
initialize_copy(other) Link
insert_after(index, *args, &block) Link
last() Link
move(target, source) Link
Also aliased as: move_before
# File actionpack/lib/action_dispatch/middleware/stack.rb, line 142 def move(target, source) source_index = assert_index(source, :before) source_middleware = middlewares.delete_at(source_index) target_index = assert_index(target, :before) middlewares.insert(target_index, source_middleware) end
move_after(target, source) Link
# File actionpack/lib/action_dispatch/middleware/stack.rb, line 152 def move_after(target, source) source_index = assert_index(source, :after) source_middleware = middlewares.delete_at(source_index) target_index = assert_index(target, :after) middlewares.insert(target_index + 1, source_middleware) end