Module: Statum::ClassMethods
- Defined in:
- lib/statum/class_methods.rb
Instance Method Summary collapse
-
#state_machines ⇒ Array<Statum::Machine>
Returns defined state machines.
-
#statum(field, options = {}, &block) ⇒ Object
Define new state machine.
Instance Method Details
#state_machines ⇒ Array<Statum::Machine>
Returns defined state machines
18 19 20 |
# File 'lib/statum/class_methods.rb', line 18 def state_machines instance_variable_get(STATE_MACHINES_VARIABLE) || [] end |
#statum(field, options = {}, &block) ⇒ Object
Define new state machine
9 10 11 12 13 |
# File 'lib/statum/class_methods.rb', line 9 def statum(field, = {}, &block) definer = Statum::StateDefiner.new(self, field, ) definer.instance_eval(&block) if block_given? add_machine(definer.state_machine) end |