Class: Orchparty::CommonBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/orchparty/dsl_parser.rb

Instance Method Summary collapse

Methods inherited from Builder

build

Constructor Details

#initialize(node) ⇒ CommonBuilder

Returns a new instance of CommonBuilder.



162
163
164
# File 'lib/orchparty/dsl_parser.rb', line 162

def initialize(node)
  @node = node
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *values, &block) ⇒ Object



170
171
172
173
174
175
176
# File 'lib/orchparty/dsl_parser.rb', line 170

def method_missing(name, *values, &block)
  if block_given?
    @node[name] = HashBuilder.build(block)
  else
    @node[name] = values.first
  end
end

Instance Method Details

#_buildObject



178
179
180
# File 'lib/orchparty/dsl_parser.rb', line 178

def _build
  @node
end

#mix(name) ⇒ Object



166
167
168
# File 'lib/orchparty/dsl_parser.rb', line 166

def mix(name)
  @node._mix << name
end

#variables(&block) ⇒ Object



182
183
184
185
# File 'lib/orchparty/dsl_parser.rb', line 182

def variables(&block)
  @node._variables = HashBuilder.build(block)
  self
end