Created
August 6, 2014 18:15
-
-
Save alloy-d/d3c9a6f5f9532e96e597 to your computer and use it in GitHub Desktop.
YOLOHash: stop caring about all that "strings vs symbols" nonsense
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 YOLOHash < Hash | |
def [](key) | |
super(key.send((rand(2) % 2 == 1) ? :to_sym : :to_s)) | |
end | |
def []=(key,val) | |
super(key.send((rand(2) % 2 == 1) ? :to_sym : :to_s), val) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment