Skip to content

Instantly share code, notes, and snippets.

@mgamba
Created February 10, 2014 23:35
Show Gist options
  • Save mgamba/8926439 to your computer and use it in GitHub Desktop.
Save mgamba/8926439 to your computer and use it in GitHub Desktop.
method to pluck values from a hash
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