From: Dave Burt Date: 2004-11-10T17:18:32+09:00 Subject: When is a key not a key? Hi, I hesitate to write because some of my code here is pretty evil, but this problem is weirding me out a bit. I have a hash (loan_shark) indexed by instances of a particular struct (Player). The hash seems to be failing to find its keys when I try to look them up. Like this: loan_shark.size #=> 4 loan_shark.has_key?(loan_shark.keys[0]) #=> false Any ideas? The background is something like this: Player = Struct.new(:name, :bankroll, :hands) .... loan_shark = {} .... newb = Player.new("Fred", some_dollars) .... loan_shark[newb] = some_dollars .... players << newb If you feel the need, you can get all the code (about 15k) here: http://www.dave.burt.id.au/ruby/blackjack.rb http://www.dave.burt.id.au/ruby/cards.rb (The issue can be found near blackjack.rb:304, complete with futile debugging code) Cheers, Dave