Created
October 2, 2015 18:53
-
-
Save dugger/9314033daa2d6b4368a0 to your computer and use it in GitHub Desktop.
Lets create a hash that can handle missing keys (treat them as nil)! π
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 MyHash < Hash | |
def []=(key=nil, value) | |
super(key,value) | |
end | |
def [](key=nil) | |
super(key) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment