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
Instance Method Summary collapse
-
#initialize(klass, *args) ⇒ Middleware
constructor
:nodoc:.
- #valid?(action) ⇒ Boolean
Methods inherited from ActionDispatch::MiddlewareStack::Middleware
Constructor Details
#initialize(klass, *args) ⇒ Middleware
:nodoc:
15 16 17 18 19 20 21 |
# File 'lib/action_controller/metal.rb', line 15 def initialize(klass, *args) = 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
23 24 25 26 27 28 29 30 31 |
# File 'lib/action_controller/metal.rb', line 23 def valid?(action) if @only.present? @only.include?(action) elsif @except.present? !@except.include?(action) else true end end |