Wait, no.

hash.map{|k, v| k, {'name' => v}}.to_hash

This should work.

Or
h = {}
hash.each{|k, v| h.add(k, {'name' => 'v'})

Aur

On 7/16/07, SonOfLilit <sonoflilit / gmail.com> wrote:
> hash.map{|k, v| {k => {'name' => v}}.to_hash
>
> should work.
>
> Not sure if there's a prettier solution.
>
> Aur
>
> On 7/16/07, Shai Rosenfeld <shaiguitar / gmail.com> wrote:
> > hi,
> > was wondering what the prettiest way to do the below would be:
> >
> > i got a hash
> >
> > { '1' => 'some', '4' => 'thing', '6' => 'good' }
> >
> > and i want to turn it into
> >
> > { '1' => {'name' => 'some'}, '4' => {'name' => 'thing'}, '6' =>
> > {'name'=>'good'} }
> >
> > --
> > Posted via http://www.ruby-forum.com/.
> >
> >
>