title: Ruby array intersection
body: <p>Two arrays containing objects, is not returning intersect when using '&amp;' between the arrays.
  Please take a look at the snippet below:</p>
  
  <pre><code>ruby-1.9.2-p290 :001 &gt; class A
  ruby-1.9.2-p290 :002?&gt;   include Comparable
  ruby-1.9.2-p290 :003?&gt;   attr_reader :key
  ruby-1.9.2-p290 :004?&gt;   def initialize(key)
  ruby-1.9.2-p290 :005?&gt;     @key = key
  ruby-1.9.2-p290 :006?&gt;     end
  ruby-1.9.2-p290 :007?&gt;   def &lt;=&gt; obj
  ruby-1.9.2-p290 :008?&gt;     @key &lt;=&gt; obj.key
  ruby-1.9.2-p290 :009?&gt;     end
  ruby-1.9.2-p290 :010?&gt;   end
   =&gt; nil 
  ruby-1.9.2-p290 :011 &gt; class B
  ruby-1.9.2-p290 :012?&gt;   attr_reader :key
  ruby-1.9.2-p290 :013?&gt;   def initialize(key)
  ruby-1.9.2-p290 :014?&gt;     @key = key
  ruby-1.9.2-p290 :015?&gt;     end
  ruby-1.9.2-p290 :016?&gt;   end
   =&gt; nil 
  ruby-1.9.2-p290 :017 &gt; A.new(1) == A.new(1)
   =&gt; true 
  ruby-1.9.2-p290 :019 &gt; B.new(1) == B.new(1)
   =&gt; false 
  ruby-1.9.2-p290 :020 &gt; a1 = [A.new(1), A.new(2), A.new(3)]
   =&gt; [#&lt;A:0x000001009e2f68 @key=1&gt;, #&lt;A:0x000001009e2f40 @key=2&gt;, #&lt;A:0x000001009e2f18 @key=3&gt;] 
  ruby-1.9.2-p290 :021 &gt; a2 = [A.new(3), A.new(4), A.new(5)]
   =&gt; [#&lt;A:0x000001009d44e0 @key=3&gt;, #&lt;A:0x000001009d44b8 @key=4&gt;, #&lt;A:0x000001009d4490 @key=5&gt;] 
  ruby-1.9.2-p290 :023 &gt; a1 | a2
   =&gt; [#&lt;A:0x000001009e2f68 @key=1&gt;, #&lt;A:0x000001009e2f40 @key=2&gt;, #&lt;A:0x000001009e2f18 @key=3&gt;, #&lt;A:0x000001009d44e0 @key=3&gt;, #&lt;A:0x000001009d44b8 @key=4&gt;, #&lt;A:0x000001009d4490 @key=5&gt;] 
  ruby-1.9.2-p290 :024 &gt; a1 &amp; a2
   =&gt; [] 
  </code></pre>
  
  <p>shouldn't a1 &amp; a2 return:</p>
  
  <pre><code>[#&lt;A:0x000001009e2f18 @key=3&gt;]
  </code></pre>
  
  <p>or, I am just missing something...</p>