Module: Stateflow
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/stateflow.rb,
lib/stateflow/event.rb,
lib/stateflow/state.rb,
lib/stateflow/railtie.rb,
lib/stateflow/machine.rb,
lib/stateflow/exception.rb,
lib/stateflow/transition.rb,
lib/stateflow/persistence.rb,
lib/stateflow/persistence/none.rb,
lib/stateflow/persistence/mongoid.rb,
lib/stateflow/persistence/mongo_mapper.rb,
lib/stateflow/persistence/active_record.rb
Defined Under Namespace
Modules: ClassMethods, Persistence
Classes: Event, IncorrectTransition, Machine, NoEventFound, NoStateFound, NoTransitionFound, Railtie, State, Transition
Instance Attribute Summary (collapse)
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Instance Attribute Details
- (Object) _previous_state
Returns the value of attribute _previous_state
45
46
47
|
# File 'lib/stateflow.rb', line 45
def _previous_state
@_previous_state
end
|
Class Method Details
+ (Object) persistence
11
12
13
|
# File 'lib/stateflow.rb', line 11
def self.persistence
@@persistence ||= nil
end
|
+ (Object) persistence=(persistence)
15
16
17
|
# File 'lib/stateflow.rb', line 15
def self.persistence=(persistence)
@@persistence = persistence
end
|
Instance Method Details
- (Object) available_states
60
61
62
|
# File 'lib/stateflow.rb', line 60
def available_states
machine.states.keys
end
|
- (Object) current_state
47
48
49
|
# File 'lib/stateflow.rb', line 47
def current_state
@current_state ||= load_from_persistence.nil? ? machine.initial_state : machine.states[load_from_persistence.to_sym]
end
|
- (Object) machine
56
57
58
|
# File 'lib/stateflow.rb', line 56
def machine
self.class.machine
end
|
- (Object) set_current_state(new_state, options = {})
51
52
53
54
|
# File 'lib/stateflow.rb', line 51
def set_current_state(new_state, options = {})
save_to_persistence(new_state.name.to_s, options)
@current_state = new_state
end
|