From: Tom Willis Date: 2005-03-08T21:29:08+09:00 Subject: Re: Noob:Objects as key in hash On Tue, 8 Mar 2005 20:51:55 +0900, Douglas Livingstone wrote: > Good job :) > > I think you can get rid of the returns too: > > #---ruby proggie > class PointID > attr_reader :x,:y > > def initialize(x,y) > @x, @y = x, y > freeze > end > > def hash > [@x.object_id, @y.object_id].hash > end > > def ==(other) > self.hash == other.hash > end > > def eql?(other) > self == other > end > > def to_s > "#{@x},#{@y}" > end > > end > #---end proggie > > Douglas > > On Mon, 7 Mar 2005 07:00:32 +0900, Tom Willis wrote: > > > > Thanks again for all the feedback. Hopefully someday I can return the favor. > > -- > > Thomas G. Willis > > http://paperbackmusic.net > > > > > > Whoa that's crazy, I'm not sure if I'm ready to give up returns yet. It took me 2 years to feel ok about not declaring variable types or even worrying about it. Someday it will probably happen. ;) -- Thomas G. Willis http://paperbackmusic.net