Method: CGenerator::KeyAccumulator#add_one

Defined in:
lib/cgen/cgen.rb

#add_one(item) ⇒ Object



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/cgen/cgen.rb', line 498

def add_one item
## why not do this?
#    unless item.is_a? Hash
#      raise ArgumentError,
#        "Tried to add non-hash '#{item}' to KeyAccumulator."
#    end
  
  item = item.sort_by {|k,v| k.to_s} unless item.is_a?(Array)
  
  for key, value in item
    if not @hash.has_key? key
      super key
    end
    @hash[key] = value_filter(value)
  end
end