From: Alex Allmont Date: 2011-06-07T19:12:33+09:00 Subject: Re: Best way to replace hash keys 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 gives 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 inefficient. 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 Grimm 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 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. -- Avdi Grimm http://avdi.org