Class: Deltacloud::StateMachine::State
- Inherits:
-
Object
- Object
- Deltacloud::StateMachine::State
- Defined in:
- lib/deltacloud/state_machine.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#transitions ⇒ Object
readonly
Returns the value of attribute transitions.
Instance Method Summary collapse
-
#initialize(machine, name) ⇒ State
constructor
A new instance of State.
- #to(destination_name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(machine, name) ⇒ State
Returns a new instance of State.
38 39 40 41 42 |
# File 'lib/deltacloud/state_machine.rb', line 38 def initialize(machine, name) @machine = machine @name = name @transitions = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/deltacloud/state_machine.rb', line 35 def name @name end |
#transitions ⇒ Object (readonly)
Returns the value of attribute transitions.
36 37 38 |
# File 'lib/deltacloud/state_machine.rb', line 36 def transitions @transitions end |
Instance Method Details
#to(destination_name) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/deltacloud/state_machine.rb', line 48 def to(destination_name) destination = @machine.state(destination_name) transition = Transition.new( @machine, destination ) @transitions << transition transition end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/deltacloud/state_machine.rb', line 44 def to_s self.name.to_s end |