Interesting Things
If you want to override how an object is stored in a Hash internally, you can override the Object#hash and Object#eql? methods. Hash always uses Object#hash in its internal hashtable. Try to keep this assertion in mind too:
foo.hash.should == bar.hash if foo.eql?(bar)
Instead of inventing some reliable algorithm to generate your hash code, you can call #hash on a object that can serve as a proxy hash generator. For example, if your object has a #name method, your #hash method could return name.hash.