Class: Philiprehberger::StateMachine::AutoTransition
- Inherits:
-
Struct
- Object
- Struct
- Philiprehberger::StateMachine::AutoTransition
- Defined in:
- lib/philiprehberger/state_machine/auto_transition.rb
Overview
Represents a timed automatic transition.
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#from ⇒ Object
Returns the value of attribute from.
-
#guard ⇒ Object
Returns the value of attribute guard.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
-
#matches?(current_state) ⇒ Boolean
Check if this auto-transition applies to the given state.
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after
6 7 8 |
# File 'lib/philiprehberger/state_machine/auto_transition.rb', line 6 def after @after end |
#from ⇒ Object
Returns the value of attribute from
6 7 8 |
# File 'lib/philiprehberger/state_machine/auto_transition.rb', line 6 def from @from end |
#guard ⇒ Object
Returns the value of attribute guard
6 7 8 |
# File 'lib/philiprehberger/state_machine/auto_transition.rb', line 6 def guard @guard end |
#to ⇒ Object
Returns the value of attribute to
6 7 8 |
# File 'lib/philiprehberger/state_machine/auto_transition.rb', line 6 def to @to end |
Instance Method Details
#matches?(current_state) ⇒ Boolean
Check if this auto-transition applies to the given state.
11 12 13 14 15 16 17 |
# File 'lib/philiprehberger/state_machine/auto_transition.rb', line 11 def matches?(current_state) if from.is_a?(Array) from.include?(current_state) else from == current_state end end |