1 2 3 4 5 6 7 8 9 10 11
class Class def hash_on(delegatee) define_method :eql? do |other| self == other end define_method :hash do @hash ||= delegatee.hash end end end