Created
June 5, 2010 02:57
-
-
Save guimello/426246 to your computer and use it in GitHub Desktop.
additional methods for hash (easy to work on rspec)
This file contains hidden or 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 | |
#for overriding keys | |
alias :with :merge | |
# for excluding keys | |
def except(*exclusions) | |
self.reject { |key, value| exclusions.include? key.to_sym } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment