How do I change all the keys of a hash by a new set of given keys?
Is there a way to do that elegantly?
Assuming you have a Hash which maps old keys to new keys, you could do something like
Hash
hsh.transform_keys(&key_map.method(:[]))
1.4m articles
1.4m replys
5 comments
57.0k users