class Orchparty::Kubernetes::HashBuilder

Public Instance Methods

_build() click to toggle source
# File lib/orchparty/dsl_parser_kubernetes.rb, line 265
def _build
  @hash
end
method_missing(_, *values, &block) click to toggle source
# File lib/orchparty/dsl_parser_kubernetes.rb, line 241
def method_missing(_, *values, &block)
  if block_given?
    value = HashBuilder.build(block)
    if values.count == 1
      @hash ||= AST.hash
      @hash[values.first.to_sym] = value
    else
      @hash ||= AST.array
      @hash << value
    end
  else
    value = values.first
    if value.is_a? Hash
      @hash ||= AST.hash
      key, value = value.first
      @hash[key.to_sym] = value
    else
      @hash ||= AST.array
      @hash << value
    end
  end
  self
end