You can also use __id__ . This gives you an internal object identification number that is always unique. To check if the objects are the same, try
a.__id__ = b.__id__
So the standard Ruby library does this as far as I can tell (see group_by and others).
wvdschel
source share