From: Andrew Walrond Date: 2005-05-06T02:07:30+09:00 Subject: Re: Whats so different about a Hash? On Thursday 05 May 2005 16:39, Florian Gro� wrote: > Adriano Ferreira wrote: > >>What does 1.9 do for Hash#eql? ? > > > > Probably some equivalent to: > > > > class Hash > > def eql?(b) > > h1 = (self.length >= b.length) ? self : b > > h2 = (self.length >= b.length) ? b : self > > return h1.all? { | k, v | v.eql?(h2[k]) } > > end > > end > > > > where setting h1, h2 is a trick for granting there will be no false > > positives. > > Hm, I'm okay with the last part (checking if all pairs are shared), but > I'd replace the h1, h2 stuff with self.size == other.size. Whats wrong with just using cdef eql?(other) self == other end It seems to work. I assume == does something similar anyway?. Am I missing something? Andrew