From: Vladimir Dozen Date: 2002-03-15T22:50:21+09:00 Subject: Re: key comparision inside Hash ehlo. > Seeing your lovely functional requirement, I couldn't help myself, so I > had a stab at it: > module NaiveHashable > def hash > inst = instance_variables > h = type.hash ^ inst.size.hash > inst.each{|i| > h ^= i.hash ^ eval(i).hash > } > h > end > end Wow! I cannot think in Ruby yet :((( Your solution is enough for me, and looks much more Ruby-way... except for: I would call module Hashable or HashKeyable, and include realization of eql? method with similar algorithm. Then, the requirement for key objects would be "implement hash and eql? methods OR include HashKeyable module". dozen