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
55 56 57 |
# File 'lib/transitions.rb', line 55 def available_events @state_machine.events.keys.sort end |
#available_states ⇒ Object
51 52 53 |
# File 'lib/transitions.rb', line 51 def available_states @state_machine.states.map(&:name).sort_by {|x| x.to_s} end |
#get_state_machine ⇒ Object
49 |
# File 'lib/transitions.rb', line 49 def get_state_machine; @state_machine; end |
#inherited(klass) ⇒ Object
34 35 36 37 |
# File 'lib/transitions.rb', line 34 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
44 45 46 47 |
# File 'lib/transitions.rb', line 44 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.
40 41 42 |
# File 'lib/transitions.rb', line 40 def state_machine=(value) @state_machine = value.dup end |