Class: StrictMachine::TransitionDefinition
- Defined in:
- lib/strict_machine/definition/transition_definition.rb
Instance Attribute Summary collapse
-
#guard ⇒ Object
readonly
Returns the value of attribute guard.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #guarded? ⇒ Boolean
-
#initialize(definition) ⇒ TransitionDefinition
constructor
A new instance of TransitionDefinition.
Constructor Details
#initialize(definition) ⇒ TransitionDefinition
Returns a new instance of TransitionDefinition.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/strict_machine/definition/transition_definition.rb', line 5 def initialize(definition) definition.each_pair do |k, v| if k == :if @guard = v.to_sym else @name = k.to_sym @to = v.to_sym end end end |
Instance Attribute Details
#guard ⇒ Object (readonly)
Returns the value of attribute guard.
3 4 5 |
# File 'lib/strict_machine/definition/transition_definition.rb', line 3 def guard @guard end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/strict_machine/definition/transition_definition.rb', line 3 def name @name end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
3 4 5 |
# File 'lib/strict_machine/definition/transition_definition.rb', line 3 def to @to end |
Instance Method Details
#guarded? ⇒ Boolean
16 17 18 |
# File 'lib/strict_machine/definition/transition_definition.rb', line 16 def guarded? !@guard.nil? end |