Module: NxtStateMachine::InstanceMethods

Defined in:
lib/nxt_state_machine.rb

Instance Method Summary collapse

Instance Method Details

#current_state(name = :default) ⇒ Object



85
86
87
# File 'lib/nxt_state_machine.rb', line 85

def current_state(name = :default)
  state_machines.resolve!(name).states.resolve!(current_state_name(name))
end

#current_state_name(name = :default) ⇒ Object



81
82
83
# File 'lib/nxt_state_machine.rb', line 81

def current_state_name(name = :default)
  state_machines.resolve!(name).current_state_name(self)
end

#halt_transition(*args, **opts) ⇒ Object



89
90
91
# File 'lib/nxt_state_machine.rb', line 89

def halt_transition(*args, **opts)
  raise NxtStateMachine::Errors::TransitionHalted.new(*args, **opts)
end

#state_machine(name = :default) ⇒ Object



77
78
79
# File 'lib/nxt_state_machine.rb', line 77

def state_machine(name = :default)
  @state_machine ||= self.class.state_machines.resolve!(name)
end

#state_machinesObject



73
74
75
# File 'lib/nxt_state_machine.rb', line 73

def state_machines
  @state_machines ||= self.class.state_machines
end