Class: ActionController::MiddlewareStack
- Inherits:
-
ActionDispatch::MiddlewareStack
- Object
- ActionDispatch::MiddlewareStack
- ActionController::MiddlewareStack
- Defined in:
- lib/action_controller/metal.rb
Overview
Extend ActionDispatch middleware stack to make it aware of options allowing the following syntax in controllers:
class PostsController < ApplicationController
use AuthenticationMiddleware, :except => [:index, :show]
end
Defined Under Namespace
Classes: Middleware
Instance Attribute Summary
Attributes inherited from ActionDispatch::MiddlewareStack
Instance Method Summary collapse
Methods inherited from ActionDispatch::MiddlewareStack
#[], #delete, #each, #initialize, #initialize_copy, #insert, #insert_after, #last, #size, #swap, #use
Constructor Details
This class inherits a constructor from ActionDispatch::MiddlewareStack
Instance Method Details
#build(action, app = nil, &block) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/action_controller/metal.rb', line 34 def build(action, app=nil, &block) app ||= block action = action.to_s raise "MiddlewareStack#build requires an app" unless app middlewares.reverse.inject(app) do |a, middleware| middleware.valid?(action) ? middleware.build(a) : a end end |