From: Mark Wilson Date: 2003-06-10T05:22:35+09:00 Subject: Re: array.uniq does not use == ? On Monday, June 9, 2003, at 03:47 PM, Orion Hunter wrote: > [snip many interesting things I want to think about] > And, actually, after taking a closer look at the solution you > provided... I'm not too sure I see how would work. Doesn't .inspect > also return the Object.hash attribute of the object, which, unless > defined otherwise, will be different for every object? This would > then make each object different, even if all the other attributes are > the same. > > Matt > [snip] For Sets and Arrays, .inspect does not return the Object.hash attribute. See below. I have not examined this behavior for all object classes. Others on the list may be able to precisely explain what is going and offer a more elegant solution. irb(main):001:0> require 'set' => true irb(main):002:0> set = Set.new([1,2,3,4,5]) => # irb(main):003:0> set.inspect => "#" array = [Set.new([1,2,3]), Set.new([4,5,6])] => [#, #] irb(main):008:0> array.inspect => "[#, #]" Regards, Mark