Skip to content

Instantly share code, notes, and snippets.

@jemmons
Created May 6, 2009 19:22
Show Gist options
  • Save jemmons/107681 to your computer and use it in GitHub Desktop.
Save jemmons/107681 to your computer and use it in GitHub Desktop.
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