2008/8/20 Martin DeMello <martindemello / gmail.com>:
> On Wed, Aug 20, 2008 at 11:26 AM, Robert Klemme
> <shortcutter / googlemail.com> wrote:
>>
>> Folks, thanks for leaving the #inject solution to me. :-)
>>
>> map = hash.inject({}) do |h,(k,v)|
>>  h[k.upcase] = v
>>  h
>> end
>
> without the ugly "h" at the end :) :
>
>  map = hash.inject({}) {|h, (k,v)| h.update({k.upcase => v})}

But with ugly and unnecessary brackets.  This works as well

map = hash.inject({}) {|h, (k,v)| h.update(k.upcase => v)}

Note though that this unfortunately creates a lot of temporary Hashes
that are thrown away immediately. I personally find that more ugly
than the h at the end.  You can reformat to make it less stand out as
in

map = hash.inject {} do |h,(k,v)|
 h[k.upcase] = v; h
end

Kind regards

robert

-- 
use.inject do |as, often| as.you_can - without end