title: How to make object instance a hash key in Ruby?
body: <p>I have a class  Foo  with a few member variables. When all values in two instances of the class are equal I want the objects to be 'equal'.  I'd then like these objects to be keys in my hash.  When I currently try this, the hash treats each instance as unequal.</p>
  
  <pre><code>h = {}
  f1 = Foo.new(a,b)
  f2 = Foo.new(a,b)
  </code></pre>
  
  <p>f1 and f2 should be equal at this point.</p>
  
  <pre><code>h[f1] = 7
  h[f2] = 8
  puts h[f1]
  </code></pre>
  
  <p>should print 8</p>