From: Marcin Wolski Date: 2010-06-04T17:16:34+09:00 Subject: Re: comparing objects Robert Dober wrote: > On Fri, Jun 4, 2010 at 3:41 AM, Marcin Wolski wrote: > >> �def ==(other) >> �@email == other.email >> �end > this seems ok >> >> �alias eql? == >> >> �def hash >> � �code = 17 >> � �code = 37*code + @email.hash >> end >> > Are you sure you want to do this? "equal" objects would overwrite each > other when used as hash keys. This is normally not a good idea, be > sure you really want/need this! > R What would be the other possible solution to this problem? The example code will not work without overwritten eql? and hash methods. -- Posted via http://www.ruby-forum.com/.