Class: Deltacloud::StateMachine::Transition
- Inherits:
-
Object
- Object
- Deltacloud::StateMachine::Transition
- Defined in:
- lib/deltacloud/models/state_machine.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
- #automatically ⇒ Object
- #automatically? ⇒ Boolean
-
#initialize(machine, destination) ⇒ Transition
constructor
A new instance of Transition.
- #on(action) ⇒ Object
Constructor Details
#initialize(machine, destination) ⇒ Transition
Returns a new instance of Transition.
99 100 101 102 103 104 |
# File 'lib/deltacloud/models/state_machine.rb', line 99 def initialize(machine, destination) @machine = machine @destination = destination @auto = false @action = nil end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
97 98 99 |
# File 'lib/deltacloud/models/state_machine.rb', line 97 def action @action end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
96 97 98 |
# File 'lib/deltacloud/models/state_machine.rb', line 96 def destination @destination end |
Instance Method Details
#automatically ⇒ Object
106 107 108 |
# File 'lib/deltacloud/models/state_machine.rb', line 106 def automatically @auto = true end |
#automatically? ⇒ Boolean
110 111 112 |
# File 'lib/deltacloud/models/state_machine.rb', line 110 def automatically? @auto end |
#on(action) ⇒ Object
114 115 116 117 118 119 |
# File 'lib/deltacloud/models/state_machine.rb', line 114 def on(action) unless @machine.valid_action_name?(action) raise "Action '#{action}' not in list of allowed actions" end @action = action end |