Module: Stateflow::Persistence::MongoMapper::InstanceMethods
- Defined in:
- lib/stateflow/persistence/mongo_mapper.rb
Instance Method Summary collapse
- #ensure_initial_state ⇒ Object
- #load_from_persistence ⇒ Object
- #save_to_persistence(new_state, options = {}) ⇒ Object
Instance Method Details
#ensure_initial_state ⇒ Object
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_persistence ⇒ Object
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, = {}) send("#{machine.state_column}=".to_sym, new_state) save if [:save] end |