From: Stefano Mioli Date: 2011-07-16T03:41:59+09:00 Subject: Re: Comparing hashes based on their keys On 7/15/11 7:18 PM, Rob Biedenharn wrote: > I don't see why you couldn't just add your own method to Hash. (Tested > on ruby-1.9.2) [snip] > But that's probably a stretch and only *you* can decided if it's right > for the situation. I posted in the same gist a revised version of your method (see comment below). I ended up not monkey-patching NilClass. I will just throw an ArgumentError if the argument is nil. > P.S. I'm assuming that you don't consider supersets of keys to be > "equal" and that you really do care that all the keys are symbols. You're right about the supersets: if hash x as a key k and hash y misses that key, the two hashes are different. About the symbols: I don't really care, because I know they will be symbols. Thank you very much. -- Stefano Mioli