Method: Confection::HashBuilder#method_missing

Defined in:
lib/confection/hash_builder.rb

#method_missing(s, *a, &b) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/confection/hash_builder.rb', line 29

def method_missing(s, *a, &b)
  m = s.to_s
  if a.empty? && !b
    @hash[m.to_sym]
  else
    if b
      @hash[m.chomp('=').to_sym] = HashBuilder.new(&b).to_h
    else
      if a.size > 1
        @hash[m.chomp('=').to_sym] = a
      else
        @hash[m.chomp('=').to_sym] = a.first
      end
    end
  end
end