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(:[]))
2.1m questions
2.1m answers
60 comments
57.0k users