"Timothy Goddard" <interfecus / gmail.com> writes: > Hashes don't behave well as keys either so it's no surprise openstructs > (which are based on them) don't. Nested hashes are usually sufficient, > but I agree the hashing of hashes and openstructs is pretty strange > strange. If you really need to use openstructs as keys you could use: > > class OpenStruct > def hash > @table.to_a.hash > end > end Careful! @table.to_a is ordered arbitrarily, so that hash function won't quite work. Better sort that array, or use another hashing strategy. @table.to_a.sort_by{|k,v| k.to_i}.hash