2015-05-15 06:32:40 -04:00
|
|
|
class ProvidedState
|
|
|
|
attr_accessor :transient_store, :persisted_store
|
|
|
|
include AASM
|
|
|
|
aasm do
|
|
|
|
state :alpha, :initial => true
|
|
|
|
state :beta
|
|
|
|
state :gamma
|
|
|
|
event :release do
|
|
|
|
transitions :from => [:alpha, :beta, :gamma], :to => :beta
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-05 06:16:25 -04:00
|
|
|
def aasm_read_state(*args)
|
2015-05-15 06:32:40 -04:00
|
|
|
:beta
|
|
|
|
end
|
|
|
|
|
2015-05-05 06:16:25 -04:00
|
|
|
def aasm_write_state(new_state, *args)
|
2015-05-15 06:32:40 -04:00
|
|
|
@persisted_store = new_state
|
|
|
|
end
|
|
|
|
|
2015-05-05 06:16:25 -04:00
|
|
|
def aasm_write_state_without_persistence(new_state, *args)
|
2015-05-15 06:32:40 -04:00
|
|
|
@transient_store = new_state
|
|
|
|
end
|
|
|
|
end
|