Is there a simple way of remapping a hash in ruby the following way:
from:
{:name => 'foo', :value => 'bar'}
to:
{'foo' => 'bar'}
Preferably in a way that makes it simple to do this operation while iterating over an array of this type of hashes:
from:
[{:name => 'foo', :value => 'bar'}, {:name => 'foo2', :value => 'bar2'}]
to:
{'foo' => 'bar', 'foo2' => 'bar2'}
Thanks.
1 Answer