Module: SimpleState::Mixins::Singleton
- Defined in:
- lib/simple_state/mixins.rb
Overview
Defines singleton methods which are mixed in to a class when state_machine is called.
Instance Method Summary collapse
- #_determine_new_state(current, to) ⇒ Object private
- #_event_permitted?(current, to) ⇒ Boolean private
- #initial_state ⇒ Object
- #initial_state=(state) ⇒ Object
- #states ⇒ Object private
Instance Method Details
#_determine_new_state(current, to) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/simple_state/mixins.rb', line 40 def _determine_new_state(current, to) states[current] && (t = states[current].assoc(to)) && t.last end |
#_event_permitted?(current, to) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/simple_state/mixins.rb', line 45 def _event_permitted?(current, to) states[current] and not states[current].assoc(to).nil? end |
#initial_state ⇒ Object
35 36 37 |
# File 'lib/simple_state/mixins.rb', line 35 def initial_state class_variable_get(:@@initial_state) end |
#initial_state=(state) ⇒ Object
30 31 32 |
# File 'lib/simple_state/mixins.rb', line 30 def initial_state=(state) class_variable_set(:@@initial_state, state) end |
#states ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/simple_state/mixins.rb', line 25 def states class_variable_get(:@@states) end |