>>>>> "C" == Chris Reay <mrchameleon / hotmail.com> writes: C> def hash C> @name @name.hash C> end C> end You must also redefine #eql? in this case, something like this pigeon% cat b.rb #!/usr/bin/ruby class Company def initialize(name) @name = name end attr_reader :name def to_s sprintf("Company(%s)", @name) end def hash @name.hash end def eql? other return false unless other.kind_of? self.class name.eql? other.name end end abc = Company.new("ABC") xyz = Company.new("ABC") portfolio = Hash.new portfolio[abc] = 10.0 portfolio[xyz] = 15.0 portfolio.keys.each do |each| printf("%s is worth %s\n", each, portfolio[each].to_s) end puts portfolio pigeon% pigeon% b.rb Company(ABC) is worth 15.0 Company(ABC)15.0 pigeon% Guy Decoux