Class: ActionSubscriber::DSL::Filter
- Inherits:
-
Object
- Object
- ActionSubscriber::DSL::Filter
- Defined in:
- lib/action_subscriber/dsl.rb
Instance Attribute Summary collapse
-
#callback_method ⇒ Object
Returns the value of attribute callback_method.
-
#excluded_actions ⇒ Object
Returns the value of attribute excluded_actions.
-
#included_actions ⇒ Object
Returns the value of attribute included_actions.
Instance Method Summary collapse
-
#initialize(callback_method, options) ⇒ Filter
constructor
A new instance of Filter.
- #matches(action) ⇒ Object
Constructor Details
#initialize(callback_method, options) ⇒ Filter
Returns a new instance of Filter.
8 9 10 11 12 |
# File 'lib/action_subscriber/dsl.rb', line 8 def initialize(callback_method, ) @callback_method = callback_method @included_actions = @excluded_actions = [] () end |
Instance Attribute Details
#callback_method ⇒ Object
Returns the value of attribute callback_method.
4 5 6 |
# File 'lib/action_subscriber/dsl.rb', line 4 def callback_method @callback_method end |
#excluded_actions ⇒ Object
Returns the value of attribute excluded_actions.
6 7 8 |
# File 'lib/action_subscriber/dsl.rb', line 6 def excluded_actions @excluded_actions end |
#included_actions ⇒ Object
Returns the value of attribute included_actions.
5 6 7 |
# File 'lib/action_subscriber/dsl.rb', line 5 def included_actions @included_actions end |
Instance Method Details
#matches(action) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/action_subscriber/dsl.rb', line 14 def matches(action) unless included_actions.empty? return included_actions.include?(action) end unless excluded_actions.empty? return false if excluded_actions.include?(action) end true end |