From: Ryan Bigg Date: 2010-06-06T08:05:01+09:00 Subject: Re: comparing objects Robert Dober wrote: > On Sat, Jun 5, 2010 at 8:55 PM, Rein Henrichs wrote: > >> The Array#& operator, like its siblings, uses the #hash and #eql? methods of >> the objects it compares. These must be the same for objects you want to be >> considered equivalent. >> > I must have made a stupid mistake in my example code, however, this is > no reason to mess with #eql? and #hash, Be warned. > In that case I stick with Robert's advice: Do not use Array#&, even > MPing Array with something like #intersect_by would be preferable. > Wow. Sorry, I am just stunned by this, so no sugar coating for you today. Array#& is a perfectly legitimate method to be using for the purpose of finding the intersect of two Array objects, which it seems what the OP wanted to do originally. I agree with Rein on this. -- Posted via http://www.ruby-forum.com/.