From: Marcin 'Qrczak' Kowalczyk Date: 2002-09-21T07:26:22+09:00 Subject: Re: Checking hash key's and values, with case insensitivity Sat, 21 Sep 2002 00:32:27 +0900, Dossy pisze: > If you're looking for case insensitive hashes you're already going > to hell. Nope. But apart from the evil $= I'm afraid Ruby doesn't provide a way to use different equality and hashing functions in a particular hash, other than wrapping keys in different objects. Usually an alternative hash and equality are made by composing a particular function with standard hash and equality. So it would be nice to have a shortcut for that: Hash.new ('by' => proc {|s| s.downcase}) It would store keys as they were given and look them up downcased. It looks a bit ugly because Ruby has only one block per method (and the block for Hash.new is already used), and there is no nicer substitute for keyword arguments, and a proc which calls a given method must be written in full that long. In my language it will look like this: dict (by: 'downcase) I haven't encountered any other need for that than case insensitive strings though. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/