From: "Peña, Botp" Date: 2007-10-29T18:29:40+09:00 Subject: Re: uniq on custom objects From: daniel åkerud [mailto:daniel.akerud@gmail.com] # a = [Obj.new("apa", 1), Obj.new("apa", 2), Obj.new("smisk", 3)] # => [#, #, #] # # a.uniq # => [#, #, #] # # But i want only one instance of "apa", and it doesn't matter # which. Is there something else I have to override? hmm, that's a unique requirement for uniq :) btw, there was a recent thread on removing dups, wc is similar in a way to uniq. anyway, try ~> a.group_by(& :name).map{|_,v|v[0]} => [#, #] sorry, i'm in ruby1.9 box right now. but the idea is that i group the objects by name, and just get the first on each group. kind regards -botp