Module: Bravery::InstanceMethods

Defined in:
lib/bravery.rb

Instance Method Summary collapse

Instance Method Details

#goto_state(state_name) ⇒ Object



31
32
33
34
35
# File 'lib/bravery.rb', line 31

def goto_state(state_name)
  state_name = state_name.to_sym
  set_state  state_name
  self.send state_name
end

#set_state(state_name) ⇒ Object



45
46
47
# File 'lib/bravery.rb', line 45

def set_state(state_name)
  @state = state_name.to_sym
end

#stateObject



37
38
39
40
41
42
43
# File 'lib/bravery.rb', line 37

def state
  if @state
    @state
  else
    @state || self.class.start_state
  end
end

#statesObject



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

def states
  self.class.states
end