Class: Forerunner::ActionData
- Inherits:
-
Object
- Object
- Forerunner::ActionData
- Defined in:
- lib/forerunner/action_data.rb,
lib/forerunner/action_data/invalid_action_type_error.rb,
lib/forerunner/action_data/missing_action_name_error.rb
Defined Under Namespace
Classes: InvalidActionTypeError, MissingActionNameError
Constant Summary collapse
- VALID_ACTION_TYPES =
%i(before around after)
Instance Attribute Summary collapse
-
#action_names ⇒ Object
readonly
Returns the value of attribute action_names.
-
#action_type ⇒ Object
readonly
Returns the value of attribute action_type.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(action_type:, action_data:, block: nil) ⇒ ActionData
constructor
A new instance of ActionData.
- #limit_to_action(action) ⇒ Object
- #params ⇒ Object
Constructor Details
#initialize(action_type:, action_data:, block: nil) ⇒ ActionData
Returns a new instance of ActionData.
7 8 9 10 11 12 13 14 15 |
# File 'lib/forerunner/action_data.rb', line 7 def initialize(action_type:, action_data:, block: nil) @action_type = action_type @options = action_data. @action_names = action_data @block = block validate_action_type! validate_action_names! end |
Instance Attribute Details
#action_names ⇒ Object (readonly)
Returns the value of attribute action_names.
5 6 7 |
# File 'lib/forerunner/action_data.rb', line 5 def action_names @action_names end |
#action_type ⇒ Object (readonly)
Returns the value of attribute action_type.
5 6 7 |
# File 'lib/forerunner/action_data.rb', line 5 def action_type @action_type end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/forerunner/action_data.rb', line 5 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/forerunner/action_data.rb', line 5 def @options end |
Instance Method Details
#limit_to_action(action) ⇒ Object
17 18 19 |
# File 'lib/forerunner/action_data.rb', line 17 def limit_to_action(action) [:only] = [action] end |
#params ⇒ Object
21 22 23 |
# File 'lib/forerunner/action_data.rb', line 21 def params action_names + [] end |