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.
23 24 25 26 |
# File 'lib/deltacloud/state_machine.rb', line 23 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
45 46 47 48 |
# File 'lib/deltacloud/state_machine.rb', line 45 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.
22 23 24 |
# File 'lib/deltacloud/state_machine.rb', line 22 def states @states end |
Instance Method Details
#finish ⇒ Object
32 33 34 |
# File 'lib/deltacloud/state_machine.rb', line 32 def finish() state(:finish) end |
#start ⇒ Object
28 29 30 |
# File 'lib/deltacloud/state_machine.rb', line 28 def start() state(:start) end |