Class: Aquam::State
- Inherits:
-
Object
- Object
- Aquam::State
- Defined in:
- lib/aquam/state.rb
Constant Summary collapse
- @@state_machine =
I have to use a class variable because it must be the same value across all the children calsses.
Also I need it defined always
nil
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object) ⇒ State
constructor
A new instance of State.
- #state_machine ⇒ Object
Constructor Details
#initialize(object) ⇒ State
Returns a new instance of State.
20 21 22 |
# File 'lib/aquam/state.rb', line 20 def initialize(object) @object = object end |
Class Method Details
.state_machine(state_machine = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/aquam/state.rb', line 9 def self.state_machine(state_machine = nil) if state_machine && !@@state_machine validate_state_machine state_machine @@state_machine = state_machine define_event_methods end @@state_machine end |
Instance Method Details
#state_machine ⇒ Object
24 25 26 |
# File 'lib/aquam/state.rb', line 24 def state_machine self.class.state_machine || fail(Aquam::InvalidStateMachineError) end |