From: Brian Candler Date: 2008-10-28T20:20:01+09:00 Subject: Re: Hash.merge_add! extension - how does this code look? Thomas Sawyer wrote: >> � # output: {1=>["foo","bar"], 2=>"baz"} > >>> {"foo"=>1, "bar"=>1, "baz"=>2}.invert > => {1=>"bar", 2=>"baz"} That's the standard Hash#invert, and as you demonstrate, it loses information in the case where multiple keys map to the same value. -- Posted via http://www.ruby-forum.com/.