Module: SimpleStateMachine::Inheritable

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

Overview

Allows subclasses to inherit state machines

Instance Method Summary collapse

Instance Method Details

#inherited(subclass) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/simple_state_machine/simple_state_machine.rb', line 42

def inherited(subclass)
  subclass.state_machine_definition = state_machine_definition.clone
  decorator = state_machine_definition.decorator
  decorator.subject = subclass
  subclass.state_machine_definition.decorator = decorator
  super
end