Created
December 5, 2008 08:03
-
-
Save merbjedi/32279 to your computer and use it in GitHub Desktop.
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
class Hash | |
# returns a new hash with key,value pairs for the specified keys | |
def choose(*keys) | |
result = {} | |
keys.each do |key| | |
result[key] = self[key] | |
end | |
return result | |
end | |
end | |
class NilClass | |
def choose(*keys) | |
return {} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment