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.



168
169
170
# File 'lib/orchparty/dsl_parser.rb', line 168

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



176
177
178
179
180
181
182
# File 'lib/orchparty/dsl_parser.rb', line 176

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



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

def _build
  @node
end

#mix(name) ⇒ Object



172
173
174
# File 'lib/orchparty/dsl_parser.rb', line 172

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

#variables(&block) ⇒ Object



188
189
190
191
# File 'lib/orchparty/dsl_parser.rb', line 188

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