From: Daniel Berger Date: 2002-11-12T06:58:26+09:00 Subject: Enumerators with hashslice - RubyConf addenda Hi all, With a little help from the fine folks on IRC, here's a bit of addenda to my Ruby Conf talk - quick enumerators using hashslice and ranges: require "hashslice" h = {} h[*(1..26)] = [*("a".."z")] h[1] -> "a" h[26] -> "z", etc Perhaps a bit Perl-like in obfuscation, but might be handy. Michael Granger also pointed out that it's useful for value transposition (if that's the correct term): h = {:name1 => "Matz", :name2 => "Nobu"} h[:name1,:name2] = h[:name2,:name1] Enjoy! Regards, Dan