Class: Hifsm::DSL::AbstractBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/hifsm/dsl/abstract_builder.rb

Direct Known Subclasses

EventBuilder, StateBuilder

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAbstractBuilder

Returns a new instance of AbstractBuilder.



13
14
15
# File 'lib/hifsm/dsl/abstract_builder.rb', line 13

def initialize
  @defs = []
end

Class Method Details

.define_dsl_callback(cb) ⇒ Object



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

def self.define_dsl_callback(cb)
  define_method(cb) do |symbol = nil, &block|
    @defs.each do |ev_def|
      ev_def[cb].push symbol || block
    end
  end
end

Instance Method Details

#each(&block) ⇒ Object



17
18
19
# File 'lib/hifsm/dsl/abstract_builder.rb', line 17

def each(&block)
  @defs.each(&block)
end