Module: Stateflow::InstanceMethods

Defined in:
lib/stateflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_previous_stateObject

Returns the value of attribute _previous_state.



42
43
44
# File 'lib/stateflow.rb', line 42

def _previous_state
  @_previous_state
end

Instance Method Details

#current_stateObject



44
45
46
# File 'lib/stateflow.rb', line 44

def current_state  
  @current_state ||= load_from_persistence.nil? ? machine.initial_state : machine.states[load_from_persistence.to_sym]
end

#machineObject



53
54
55
# File 'lib/stateflow.rb', line 53

def machine
  self.class.machine
end

#set_current_state(new_state, options = {}) ⇒ Object



48
49
50
51
# File 'lib/stateflow.rb', line 48

def set_current_state(new_state, options = {})
  save_to_persistence(new_state.name.to_s, options)
  @current_state = new_state
end