Class: Statesman::EventTransitions
- Inherits:
-
Object
- Object
- Statesman::EventTransitions
- Defined in:
- lib/statesman/event_transitions.rb
Instance Attribute Summary collapse
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
-
#initialize(machine, event_name, &block) ⇒ EventTransitions
constructor
A new instance of EventTransitions.
- #transition(options = { from: nil, to: nil }) ⇒ Object
Constructor Details
#initialize(machine, event_name, &block) ⇒ EventTransitions
Returns a new instance of EventTransitions.
5 6 7 8 9 |
# File 'lib/statesman/event_transitions.rb', line 5 def initialize(machine, event_name, &block) @machine = machine @event_name = event_name instance_eval(&block) end |
Instance Attribute Details
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
3 4 5 |
# File 'lib/statesman/event_transitions.rb', line 3 def event_name @event_name end |
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
3 4 5 |
# File 'lib/statesman/event_transitions.rb', line 3 def machine @machine end |
Instance Method Details
#transition(options = { from: nil, to: nil }) ⇒ Object
11 12 13 |
# File 'lib/statesman/event_transitions.rb', line 11 def transition( = { from: nil, to: nil }) machine.transition(, event_name) end |