Module: Transitions::ClassMethods

Includes:
Presenter
Defined in:
lib/transitions.rb

Instance Method Summary collapse

Methods included from Presenter

#available_events, #available_states

Instance Method Details

#get_state_machineObject

rubocop:disable Style/AccessorMethodName



32
33
34
# File 'lib/transitions.rb', line 32

def get_state_machine
  @state_machine
end

#inherited(klass) ⇒ Object



16
17
18
19
# File 'lib/transitions.rb', line 16

def inherited(klass)
  super # Make sure we call other callbacks possibly defined upstream the ancestor chain.
  klass.state_machine = state_machine
end

#state_machine(options = {}, &block) ⇒ Object



26
27
28
29
# File 'lib/transitions.rb', line 26

def state_machine(options = {}, &block)
  @state_machine ||= Machine.new self
  block ? @state_machine.update(options, &block) : @state_machine
end

#state_machine=(value) ⇒ Object

The only reason we need this method is for the inherited callback.



22
23
24
# File 'lib/transitions.rb', line 22

def state_machine=(value)
  @state_machine = value.dup
end