Class: Orchparty::Builder

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(*args, block) ⇒ Object



21
22
23
24
25
# File 'lib/orchparty/dsl_parser.rb', line 21

def self.build(*args, block)
  builder = new(*args)
  builder.instance_eval(&block)
  builder._build
end

Instance Method Details

#assign_or_merge(node, key, value) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/orchparty/dsl_parser.rb', line 27

def assign_or_merge(node, key, value)
  if node[key]
    merged = node[key].deep_merge_concat(value)
    puts "'#{key}' updated to '#{merged}'"
    node[key] = merged
  else
    puts "'#{key}' set to '#{value}'"
    node[key] = value
  end
end