Module: Stateflow::Persistence::MongoMapper::InstanceMethods

Defined in:
lib/stateflow/persistence/mongo_mapper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) ensure_initial_state



26
27
28
# File 'lib/stateflow/persistence/mongo_mapper.rb', line 26

def ensure_initial_state
  send("#{machine.state_column.to_s}=", current_state.name.to_s) if send(machine.state_column.to_s).blank?
end

- (Object) load_from_persistence



17
18
19
# File 'lib/stateflow/persistence/mongo_mapper.rb', line 17

def load_from_persistence
  send machine.state_column.to_sym
end

- (Object) save_to_persistence(new_state, options = {})



21
22
23
24
# File 'lib/stateflow/persistence/mongo_mapper.rb', line 21

def save_to_persistence(new_state, options = {})
  send("#{machine.state_column}=".to_sym, new_state)
  save if options[:save]
end