Hi -- On Tue, 19 Dec 2006, Robert Dober wrote: > On 12/19/06, Jeremy Wells <jwells / servalsystems.co.uk> wrote: >> >> Lobosque Lucas wrote: >> > Is there a way to compare two objects without take its ID in >> > consideration? For example: >> > >> > #<Game_Esper:0xdcc7e0 @str=6, @mdfel = 0, @name = "Ifrit"> == >> > #<Game_Esper:0xeda51e @str=6, @mdfel = 0, @name = "Ifrit"> >> > >> > It'll return false, because the object ID is different. But i want it to >> > return true, because the arguments (is it the right name?) are all >> > equal. >> > >> > Thanks >> > >> You can overwrite the == method: >> >> def ==(other_obj) >> true if self.str == other_obj.str and self.mdfel == other_obj.mdfel >> and self.name == other_obj.name >> end >> >> Sorry for making some noise here, but before doing so please let me > confirm that > (1) the question was perfectly correct and normal (well I guess) > (2) Jeremy's answer too. > It just stroke me that maybe OP would have preferred not to post this > question and having followed a link in a hypothetical FAQ Why not the real FAQ? http://www.rubygarden.org/faq David -- Q. What's a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)