module NxtStateMachine::ClassMethods
Public Instance Methods
new(*args, **opts, &block)
click to toggle source
Calls superclass method
# File lib/nxt_state_machine.rb, line 50 def new(*args, **opts, &block) instance = if opts.any? super(*args, **opts, &block) else super(*args, &block) end # set each initial state for all machines state_machines.each do |name, machine| instance.current_state_name(name) if machine.initial_state.present? end instance end
state_machine(name = :default, **opts, &config)
click to toggle source
# File lib/nxt_state_machine.rb, line 39 def state_machine(name = :default, **opts, &config) state_machines.resolve(name) || state_machines.register( name, StateMachine.new(name, self, state_machine_event_registry, **opts).configure(&config) ) end
state_machines()
click to toggle source
# File lib/nxt_state_machine.rb, line 46 def state_machines @state_machines ||= registry :state_machines end
Private Instance Methods
state_machine_event_registry()
click to toggle source
# File lib/nxt_state_machine.rb, line 67 def state_machine_event_registry @state_machine_event_registry ||= EventRegistry.new end