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

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

Instance Method Summary collapse

Instance Method Details

#ensure_initial_stateObject



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

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

#load_from_persistenceObject



12
13
14
# File 'lib/stateflow/persistence/mongo_mapper.rb', line 12

def load_from_persistence
  send machine.state_column.to_sym
end

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



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

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