From: Josh Cheek Date: 2011-08-25T14:04:23+09:00 Subject: Re: eliminate duplicate key based on value --bcaec547c8e99c733604ab4d5cc8 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Aug 24, 2011 at 12:12 PM, Lucky Nl wrote: > HI friends , > > i have hash as below > > list = {"18" => 1,"15" => 2,"15" => 3,"17" => 4,"18" => 5} > above hash there 2 duplicatekeys with values 2,3.I want to keep only one > key=> value based on value i prefered > here i want to get result as below if i select value 3 > {"18" => 1,"15" => 3,"17" => 4,"18" => 5} > > If i select value 2 i want result as {"18" => 1,"15" => 2,"17" => > 4,"18" => 5} > Can anybody help me > > I don't know of anything like this currently, but it wouldn't be too hard to make one. You need to specify what you mean by "i select value 3" what does that look like? Why don't you show how it should be used (or offer a spec or test suite). --bcaec547c8e99c733604ab4d5cc8--