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
- #mount_state_machine(mountable_class) ⇒ Object
- #state_machine_definition ⇒ Object
- #state_machine_definition=(state_machine_definition) ⇒ Object
Instance Method Details
#mount_state_machine(mountable_class) ⇒ Object
21 22 23 24 25 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 21 def mount_state_machine mountable_class self.state_machine_definition = mountable_class.new self.state_machine_definition.subject = self self.state_machine_definition.add_events end |
#state_machine_definition ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 6 def state_machine_definition unless @state_machine_definition @state_machine_definition = StateMachineDefinition.new @state_machine_definition.subject = self end @state_machine_definition end |
#state_machine_definition=(state_machine_definition) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 14 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 |