Created
May 6, 2009 19:22
-
-
Save jemmons/107681 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 Object | |
def nil_or | |
self | |
end | |
def not_nil? | |
true | |
end | |
end | |
class NilProxy | |
undef :to_s | |
undef :id | |
def method_missing(*args) | |
nil | |
end | |
def nil? | |
true | |
end | |
def not_nil? | |
false | |
end | |
end | |
class NilClass | |
def nil_or | |
NilProxy.new | |
end | |
def not_nil? | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment