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.
55 56 57 58 59 |
# File 'lib/deltacloud/state_machine.rb', line 55 def initialize(machine, name) @machine = machine @name = name @transitions = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
52 53 54 |
# File 'lib/deltacloud/state_machine.rb', line 52 def name @name end |
#transitions ⇒ Object (readonly)
Returns the value of attribute transitions.
53 54 55 |
# File 'lib/deltacloud/state_machine.rb', line 53 def transitions @transitions end |
Instance Method Details
#to(destination_name) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/deltacloud/state_machine.rb', line 65 def to(destination_name) destination = @machine.state(destination_name) transition = Transition.new( @machine, destination ) @transitions << transition transition end |
#to_s ⇒ Object
61 62 63 |
# File 'lib/deltacloud/state_machine.rb', line 61 def to_s self.name.to_s end |