Class: StateMachine::SendEventTransition
- Inherits:
-
Transition
- Object
- Transition
- StateMachine::SendEventTransition
- Defined in:
- lib/motion-state-machine/transition.rb
Overview
This is kind of the ‘standard’ transition. It is created when supplying the :on
option in the state machine definition.
If armed, the transition is triggered when sending an event to the state machine by calling Base#event with the event’s symbol as parameter. Sending the same event symbol while not armed will just ignore the event.
Note that you should call the Base#event method from the same queue / thread where the state machine was started.
Instance Attribute Summary
Attributes inherited from Transition
#destination_state, #event_trigger_value, #options, #source_state, #state_machine
Instance Method Summary collapse
- #arm ⇒ Object
- #event_description ⇒ Object
-
#initialize(options) ⇒ SendEventTransition
constructor
A new instance of SendEventTransition.
- #unarm ⇒ Object
Methods inherited from Transition
#allowed?, #inspect, make, types
Constructor Details
#initialize(options) ⇒ SendEventTransition
Returns a new instance of SendEventTransition.
280 281 282 283 |
# File 'lib/motion-state-machine/transition.rb', line 280 def initialize() super() unarm end |
Instance Method Details
#arm ⇒ Object
289 290 291 |
# File 'lib/motion-state-machine/transition.rb', line 289 def arm state_machine.register_event_handler event_trigger_value, self end |
#event_description ⇒ Object
285 286 287 |
# File 'lib/motion-state-machine/transition.rb', line 285 def event_description "after #{event_trigger_value}" end |
#unarm ⇒ Object
293 294 295 |
# File 'lib/motion-state-machine/transition.rb', line 293 def unarm state_machine.register_event_handler event_trigger_value, nil end |