Created
February 10, 2014 23:35
-
-
Save mgamba/8926439 to your computer and use it in GitHub Desktop.
method to pluck values from a hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hash_pluck(hash, keys) | |
HashWithIndifferentAccess[keys.zip(hash.values_at(*keys.map(&:to_s)))] | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment