Thanks to everyone for the responses.

I'll probably work with rekey because of the clean syntax, very readable.  =
Plus that extension generally looks very useful.

Thanks for the link Avdi, I've been struggling with using inject so this gi=
ves great insight.

I am picking apart Harry's example but I find it hard to read and I wonder =
if the array conversion, transposing, zipping, and flattening would be inef=
ficient.  Always interested in seeing alternative uses though :)

Best wishes,
Alex



-----Original Message-----
From: avdi / inbox.avdi.org [mailto:avdi / inbox.avdi.org] On Behalf Of Avdi Gr=
imm
Sent: 04 June 2011 22:52
To: ruby-talk ML
Subject: Re: Best way to replace hash keys

On Fri, Jun 3, 2011 at 10:27 AM, Alex Allmont
<Alex.Allmont / naturalmotion.com> wrote:
> What is the most optimal and neatest way to replace keys in a hash given =
a particular condition?

I wrote an article about this back in 2009:
http://avdi.org/devblog/2009/11/20/hash-transforms-in-ruby/

Hope it's helpful.

--=20
Avdi Grimm
http://avdi.org