Class: FSM::Builder
- Inherits:
-
Object
- Object
- FSM::Builder
- Defined in:
- lib/fsm/builder.rb
Overview
Builder exposees ‘only’ (well there are some other methods exposed) the methods that are required to build the configuration
Instance Method Summary collapse
-
#initialize(target_class) ⇒ Builder
constructor
Create a new Builder which creates a Machine for the target_class.
- #process(&block) ⇒ Object
Constructor Details
#initialize(target_class) ⇒ Builder
Create a new Builder which creates a Machine for the target_class
11 12 13 14 |
# File 'lib/fsm/builder.rb', line 11 def initialize(target_class) @target_class = target_class @machine = Machine.new(target_class) end |
Instance Method Details
#process(&block) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fsm/builder.rb', line 16 def process(&block) raise ArgumentError.new('Block expected') unless block_given? self.instance_eval(&block) @machine.build_transition_methods @machine end |