Class: Yasm::Context::StateConfiguration
- Inherits:
-
Object
- Object
- Yasm::Context::StateConfiguration
- Defined in:
- lib/yasm/context/state_configuration.rb,
lib/yasm/context/state_configuration/action_hook.rb
Defined Under Namespace
Classes: ActionHook
Instance Attribute Summary collapse
-
#after_actions ⇒ Object
readonly
Returns the value of attribute after_actions.
-
#before_actions ⇒ Object
readonly
Returns the value of attribute before_actions.
-
#start_state ⇒ Object
readonly
Returns the value of attribute start_state.
Instance Method Summary collapse
- #after_action(method, options = {}) ⇒ Object
- #before_action(method, options = {}) ⇒ Object
-
#initialize(start_state = nil) ⇒ StateConfiguration
constructor
A new instance of StateConfiguration.
- #start(state) ⇒ Object
Constructor Details
#initialize(start_state = nil) ⇒ StateConfiguration
Returns a new instance of StateConfiguration.
6 7 8 9 10 |
# File 'lib/yasm/context/state_configuration.rb', line 6 def initialize(start_state = nil) @start_state = start_state @after_actions = [] @before_actions = [] end |
Instance Attribute Details
#after_actions ⇒ Object (readonly)
Returns the value of attribute after_actions.
4 5 6 |
# File 'lib/yasm/context/state_configuration.rb', line 4 def after_actions @after_actions end |
#before_actions ⇒ Object (readonly)
Returns the value of attribute before_actions.
4 5 6 |
# File 'lib/yasm/context/state_configuration.rb', line 4 def before_actions @before_actions end |
#start_state ⇒ Object (readonly)
Returns the value of attribute start_state.
4 5 6 |
# File 'lib/yasm/context/state_configuration.rb', line 4 def start_state @start_state end |
Instance Method Details
#after_action(method, options = {}) ⇒ Object
16 17 18 |
# File 'lib/yasm/context/state_configuration.rb', line 16 def after_action(method, ={}) @after_actions << ActionHook.new(method, ) end |
#before_action(method, options = {}) ⇒ Object
20 21 22 |
# File 'lib/yasm/context/state_configuration.rb', line 20 def before_action(method, ={}) @before_actions << ActionHook.new(method, ) end |
#start(state) ⇒ Object
12 13 14 |
# File 'lib/yasm/context/state_configuration.rb', line 12 def start(state) @start_state = state end |