Class: Orchparty::Kubernetes::CommonBuilder

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

Instance Method Summary collapse

Methods inherited from Builder

#assign_or_merge, build

Constructor Details

#initialize(node) ⇒ CommonBuilder

Returns a new instance of CommonBuilder.



278
279
280
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 278

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



286
287
288
289
290
291
292
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 286

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

Instance Method Details

#_buildObject



294
295
296
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 294

def _build
  @node
end

#mix(name) ⇒ Object



282
283
284
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 282

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

#variables(&block) ⇒ Object



298
299
300
301
302
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 298

def variables(&block)
  @node._variables ||= {}
  @node._variables = @node._variables.merge(VariableBuilder.build(block))
  self
end