Created
October 24, 2015 13:42
-
-
Save ajm188/f34e147b42611c5f3d90 to your computer and use it in GitHub Desktop.
Don't let your hashes return nil, raise errors instead!
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 BetterHash < Hash | |
def initialize(*args) | |
super { |_, _| raise KeyError } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment