Class: Deltacloud::StateMachine
- Inherits:
-
Object
- Object
- Deltacloud::StateMachine
- Defined in:
- lib/deltacloud/state_machine.rb
Defined Under Namespace
Classes: State, Transition
Instance Attribute Summary collapse
-
#states ⇒ Object
readonly
Returns the value of attribute states.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(&block) ⇒ StateMachine
constructor
A new instance of StateMachine.
- #method_missing(sym, *args) ⇒ Object
- #start ⇒ Object
- #state(name) ⇒ Object
Constructor Details
#initialize(&block) ⇒ StateMachine
Returns a new instance of StateMachine.
6 7 8 9 |
# File 'lib/deltacloud/state_machine.rb', line 6 def initialize(&block) @states = [] instance_eval &block if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
28 29 30 31 |
# File 'lib/deltacloud/state_machine.rb', line 28 def method_missing(sym,*args) return state( sym ) if ( args.empty? ) super( sym, *args ) end |
Instance Attribute Details
#states ⇒ Object (readonly)
Returns the value of attribute states.
5 6 7 |
# File 'lib/deltacloud/state_machine.rb', line 5 def states @states end |
Instance Method Details
#finish ⇒ Object
15 16 17 |
# File 'lib/deltacloud/state_machine.rb', line 15 def finish() state(:finish) end |
#start ⇒ Object
11 12 13 |
# File 'lib/deltacloud/state_machine.rb', line 11 def start() state(:start) end |