Module: SimpleStateMachine::Mountable
- Included in:
- SimpleStateMachine, ActiveRecord
- Defined in:
- lib/simple_state_machine/simple_state_machine.rb
Overview
Allows class to mount a state_machine
Instance Method Summary collapse
Instance Method Details
#state_machine_definition ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 11 def state_machine_definition unless @state_machine_definition @state_machine_definition = StateMachineDefinition.new @state_machine_definition.lazy_decorator = lambda { Decorator.new(self) } end @state_machine_definition end |
#state_machine_definition=(state_machine_definition) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 19 def state_machine_definition= state_machine_definition @state_machine_definition = state_machine_definition state_machine_definition.transitions.each do |transition| state_machine_definition.decorator.decorate(transition) end end |