Class: ActionController::MiddlewareStack::Middleware
- Inherits:
-
ActionDispatch::MiddlewareStack::Middleware
- Object
- ActionDispatch::MiddlewareStack::Middleware
- ActionController::MiddlewareStack::Middleware
- Defined in:
- lib/action_controller/metal.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from ActionDispatch::MiddlewareStack::Middleware
#args, #block, #classcache, #name
Instance Method Summary collapse
-
#initialize(klass, *args, &block) ⇒ Middleware
constructor
:nodoc:.
- #valid?(action) ⇒ Boolean
Methods inherited from ActionDispatch::MiddlewareStack::Middleware
Constructor Details
#initialize(klass, *args, &block) ⇒ Middleware
:nodoc:
14 15 16 17 18 19 20 |
# File 'lib/action_controller/metal.rb', line 14 def initialize(klass, *args, &block) = args. @only = Array(.delete(:only)).map(&:to_s) @except = Array(.delete(:except)).map(&:to_s) args << unless .empty? super end |
Instance Method Details
#valid?(action) ⇒ Boolean
22 23 24 25 26 27 28 29 30 |
# File 'lib/action_controller/metal.rb', line 22 def valid?(action) if @only.present? @only.include?(action) elsif @except.present? !@except.include?(action) else true end end |