Module: Transitions::ClassMethods
- Defined in:
- lib/transitions.rb
Instance Method Summary collapse
- #available_events ⇒ Object
- #available_states ⇒ Object
- #get_state_machine ⇒ Object
- #inherited(klass) ⇒ Object
- #state_machine(options = {}, &block) ⇒ Object
-
#state_machine=(value) ⇒ Object
The only reason we need this method is for the inherited callback.
Instance Method Details
#available_events ⇒ Object
37 38 39 |
# File 'lib/transitions.rb', line 37 def available_events @state_machine.events.keys.sort end |
#available_states ⇒ Object
33 34 35 |
# File 'lib/transitions.rb', line 33 def available_states @state_machine.states.map(&:name).sort_by(&:to_s) end |
#get_state_machine ⇒ Object
29 30 31 |
# File 'lib/transitions.rb', line 29 def get_state_machine @state_machine end |
#inherited(klass) ⇒ Object
14 15 16 17 |
# File 'lib/transitions.rb', line 14 def inherited(klass) super # Make sure we call other callbacks possibly defined upstream the ancestor chain. klass.state_machine = state_machine end |
#state_machine(options = {}, &block) ⇒ Object
24 25 26 27 |
# File 'lib/transitions.rb', line 24 def state_machine( = {}, &block) @state_machine ||= Machine.new self block ? @state_machine.update(, &block) : @state_machine end |
#state_machine=(value) ⇒ Object
The only reason we need this method is for the inherited callback.
20 21 22 |
# File 'lib/transitions.rb', line 20 def state_machine=(value) @state_machine = value.dup end |