See Hash:
Hash uses
key.eql?to test keys for
equality. If you need to use instances
of your own classes as keys in aHash,
it is recommended that you define both
theeql?andhashmethods. The hash
method must have the property that
a.eql?(b)impliesa.hash == b.hash.
The eql? method is easy to implement: return true if all member variables are the same. For the hash method, use [@data1, @data2].hash as Marc-Andre suggests in the comments.