Module: SimpleStateMachine::Extendable

Included in:
SimpleStateMachine, ActiveRecord
Defined in:
lib/simple_state_machine/simple_state_machine.rb

Overview

Adds state machine methods to the extended class

Instance Method Summary collapse

Instance Method Details

#event(event_name, state_transitions) ⇒ Object

mark the method as an event and specify how the state should transition



33
34
35
36
37
38
39
# File 'lib/simple_state_machine/simple_state_machine.rb', line 33

def event event_name, state_transitions
  state_transitions.each do |froms, to|
    [froms].flatten.each do |from|
      state_machine_definition.add_transition(event_name, from, to)
    end
  end
end