Hash should return a fixnum.  Also, a class that defines hash should also
define eq? to ensure that it meets the protocol required by hash keys.  That
is, two objects that compare as equal with the eq? method should return the
same hash value.

E.g. your class should be changed to:

def hash
    @name.hash
end

def eq?( other )
   self == other
end

def ==( other )
   @name == other.name
end

From: "Chris Reay" <mrchameleon / hotmail.com>
> How do I refer to my objects' keys in a Hash? The following snippet
> demonstrates my problem ...
>
> class Company
>   def initialize(name)
>     @name = name
>   end
>
>   def to_s
>     sprintf("Company(%s)", @name)
>   end
>
>   def hash
>     @name
>   end
> end