From: Trans Date: 2008-11-18T17:23:42+09:00 Subject: Re: Subclassing Hash to enforce value uniqueness ala key uniqueness. On Nov 17, 11:33 pm, Adam Gardner wrote: > Anyway, if someone has either a) a prior implementation of this, or b) > some suggestions on improving my implimentation, I'd love to hear it. You may be able to save yourself some time with a little meta programming. Eg. class HashSet < Hash Hash.instance_methods(false).each do |m| define_method(m, *a, &b) r = super fix r end end def fix self.replace(self.invert.invert) end end You'll want to improve upon that code of course, probably limit it to only certain methods. But you get the idea. T.