On 2002.08.29, Jim Freeze <jim / freeze.org> wrote:
> Sorry to but in, but I don't understand exactly what you are
> trying to accomplish with CompareByValue.
> 
> Do you want to compare any two objects?
> Are you including all the contained data as well in the compare?

Forgive me -- you're not the only one to ask this question.

I'll clarify (and put it on
http://www.rubygarden.org/ruby?CompareByValue for posterity).

When you're unit-testing a class into existence, you often see
brain-dead .=='s that look like this:

 def == other
   @a == other.a && @b == other.b ...
 end

This is time-consuming, and redundant.  So, I want to
automate it.

Just simply loop over all the current instance variables,
comparing them via "==", and making sure you don't screw anything
up (like get stuck in an infinite loop, or do anything that
wouldn't work with concurrency).

To me, this is the most DWIMmy .== definition.  Maybe I'm
crazy, though.

 - Ryan King