On Jan 29, 2007, at 14:38, Shot (Piotr Szotkowski) wrote:
> I have a Set subclass, Block. I need two blocks to be considered the
> same by Set iff they have the same elements. From what I gathered, Set
> treats two objects as equal when they are eql? and have the same hash.
>
> I stuck when it comes to Block#hash, though; I need these to be  
> true:
> Block.new.hash == Block.new.hash
> Block.new([1,2]).hash == Block.new([1,2]).hash

Try:

class Block
   def hash
     to_a.hash
   end
end