Method: StateFu::Machine.for_class
- Defined in:
- lib/machine.rb
.for_class(klass, name, options = {}, &block) ⇒ Object
Class methods
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/machine.rb', line 17 def self.for_class(klass, name, ={}, &block) .symbolize_keys! name = name.to_sym unless machine = klass.state_fu_machines[ name ] machine = new() machine.bind! klass, name, [:field_name] end if block_given? machine.apply! &block end machine end |