On Tue, Mar 08, 2005 at 10:21:00AM +0900, Yukihiro Matsumoto wrote: > In message "Re: Customizing Array#uniq by defining eql?" > on Tue, 8 Mar 2005 05:16:17 +0900, "Marcel Molina Jr." <marcel / vernix.org> writes: > > |PickAxe II's documentation for Array#uniq says, > | > | Returns a new array by removing duplicate values in _arr_, where > | duplicates are detected by comparing using +eql?+. > > It creates hash internally to remove redundant values, so that > comparison is done by "eql?" but it is filtered by "hash" value first. > In other words, when you redefine "eql?" you have to redefine "hash" > as well. Thanks for the reply. Yes, indeed, I had noted that I needed to define both hash and eql?. I assumed that that was all that was needed for uniq to work as expected. The pertinent bits of code from the example I posted in the original email are as follows: def hash "#@day #@start_time #@end_time" end def ==(other_pt) self.hash == other_pt.hash end def eql?(other_pt) self == other_pt end And yet eql? doesn't even seem to be called. Thanks for your time, marcel -- Marcel Molina Jr. <marcel / vernix.org>