Class: Hifsm::DSL::StateBuilder

Inherits:
AbstractBuilder show all
Defined in:
lib/hifsm/dsl/state_builder.rb

Overview

Normalizes state definitions

Instance Method Summary collapse

Methods inherited from AbstractBuilder

define_dsl_callback, #each

Constructor Details

#initialize(options = {}, &block) ⇒ StateBuilder

Returns a new instance of StateBuilder.



6
7
8
9
10
# File 'lib/hifsm/dsl/state_builder.rb', line 6

def initialize(options = {}, &block)
  super()
  build_def(options)
  instance_eval(&block) if block
end

Instance Method Details

#event(*args, &block) ⇒ Object



20
21
22
# File 'lib/hifsm/dsl/state_builder.rb', line 20

def event(*args, &block)
  defs.first[:sub_events].push [args, block]
end

#state(*args, &block) ⇒ Object



16
17
18
# File 'lib/hifsm/dsl/state_builder.rb', line 16

def state(*args, &block)
  defs.first[:sub_states].push [args, block]
end