Module: AASM::Persistence::PlainPersistence
- Defined in:
- lib/aasm/persistence/plain_persistence.rb
Instance Method Summary collapse
-
#aasm_read_state(name = :default) ⇒ Object
may be overwritten by persistence mixins.
-
#aasm_write_state(new_state, name = :default) ⇒ Object
may be overwritten by persistence mixins.
-
#aasm_write_state_without_persistence(new_state, name = :default) ⇒ Object
may be overwritten by persistence mixins.
Instance Method Details
#aasm_read_state(name = :default) ⇒ Object
may be overwritten by persistence mixins
6 7 8 9 10 11 12 |
# File 'lib/aasm/persistence/plain_persistence.rb', line 6 def aasm_read_state(name=:default) # all the following lines behave like @current_state ||= aasm(name).enter_initial_state current = aasm(name).instance_variable_defined?("@current_state_#{name}") && aasm(name).instance_variable_get("@current_state_#{name}") return current if current aasm(name).instance_variable_set("@current_state_#{name}", aasm(name).enter_initial_state) end |
#aasm_write_state(new_state, name = :default) ⇒ Object
may be overwritten by persistence mixins
15 16 17 |
# File 'lib/aasm/persistence/plain_persistence.rb', line 15 def aasm_write_state(new_state, name=:default) true end |
#aasm_write_state_without_persistence(new_state, name = :default) ⇒ Object
may be overwritten by persistence mixins
20 21 22 |
# File 'lib/aasm/persistence/plain_persistence.rb', line 20 def aasm_write_state_without_persistence(new_state, name=:default) aasm(name).instance_variable_set("@current_state_#{name}", new_state) end |