Greg Hauptmann wrote:
> Hi, I wanted a way to be able to "add" values to a Hash such that it
> keeps  the old and the new values.  For examples example adding
> an item to a hash for which the keys are dates.   Here's a first cut.
>  Any feedback on coding style etc?

Reading your problem and code I think you missed that Hash#merge 
optionally takes a block which seems to solve your issue just fine but 
in a more generic manner:

hash = {'foo' => 'bar1'}
hash.merge! 'foo' => 'bar2' do |key, existing, new|
  Array(existing) + [new]
end
p hash # -> {"foo"=>["bar1", "bar2"]}

Additionally I would normalize all values to arrays upfront here, makes 
dealing with the hash a lot easier.

Regards
Stefan
-- 
Posted via http://www.ruby-forum.com/.