Class: Reactive::Mvc::Controller::Filters::ClassMethods::Filter
- Inherits:
-
Object
- Object
- Reactive::Mvc::Controller::Filters::ClassMethods::Filter
- Defined in:
- lib/reactive-mvc/controller/filters.rb
Overview
Filter class is an abstract base class for all filters. Handles all of the included/excluded actions but contains no logic for calling the actual filters.
Direct Known Subclasses
ClassAfterFilter, ClassBeforeFilter, ClassFilter, FilterProxy, MethodFilter, ProcFilter, ProcWithCallFilter, SymbolFilter
Instance Attribute Summary collapse
-
#excluded_actions ⇒ Object
readonly
:nodoc:.
-
#filter ⇒ Object
readonly
:nodoc:.
-
#included_actions ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #after? ⇒ Boolean
- #around? ⇒ Boolean
- #before? ⇒ Boolean
- #call(controller, &block) ⇒ Object
-
#initialize(filter) ⇒ Filter
constructor
A new instance of Filter.
- #run(controller) ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(filter) ⇒ Filter
Returns a new instance of Filter.
397 398 399 |
# File 'lib/reactive-mvc/controller/filters.rb', line 397 def initialize(filter) @filter = filter end |
Instance Attribute Details
#excluded_actions ⇒ Object (readonly)
:nodoc:
395 396 397 |
# File 'lib/reactive-mvc/controller/filters.rb', line 395 def excluded_actions @excluded_actions end |
#filter ⇒ Object (readonly)
:nodoc:
395 396 397 |
# File 'lib/reactive-mvc/controller/filters.rb', line 395 def filter @filter end |
#included_actions ⇒ Object (readonly)
:nodoc:
395 396 397 |
# File 'lib/reactive-mvc/controller/filters.rb', line 395 def included_actions @included_actions end |
Instance Method Details
#after? ⇒ Boolean
409 410 411 |
# File 'lib/reactive-mvc/controller/filters.rb', line 409 def after? type == :after end |
#around? ⇒ Boolean
413 414 415 |
# File 'lib/reactive-mvc/controller/filters.rb', line 413 def around? type == :around end |
#before? ⇒ Boolean
405 406 407 |
# File 'lib/reactive-mvc/controller/filters.rb', line 405 def before? type == :before end |
#call(controller, &block) ⇒ Object
421 422 423 |
# File 'lib/reactive-mvc/controller/filters.rb', line 421 def call(controller, &block) run(controller) end |
#run(controller) ⇒ Object
417 418 419 |
# File 'lib/reactive-mvc/controller/filters.rb', line 417 def run(controller) raise Reactive::Controller::Error, 'No filter type: Nothing to do here.' end |
#type ⇒ Object
401 402 403 |
# File 'lib/reactive-mvc/controller/filters.rb', line 401 def type :around end |