Chris Reay wrote: > How do I refer to my objects' keys in a Hash? The following snippet > demonstrates my problem ... > > Thanks > > Chris > > ------------------------------------------------------------------ > class Company > def initialize(name) > @name = name > end > > def to_s > sprintf("Company(%s)", @name) > end > > def hash > @name @name.hash should do it. Note that you will not see the hash-value (return value of hash) anywhere, it's only used internally. Instead the value of to_s is printed as hash-key. Regards, Michael -- Michael Neumann merlin.zwo InfoDesign GmbH http://www.merlin-zwo.de