Skip to content

Instantly share code, notes, and snippets.

@antonrogov
Created January 10, 2011 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonrogov/772916 to your computer and use it in GitHub Desktop.
Save antonrogov/772916 to your computer and use it in GitHub Desktop.
nil is true in ?:
class Proxy
instance_methods.each do |method|
undef_method(method) unless method =~ /(^__|^send$|^object_id$|^extend$)/
end
def initialize(target)
@target = target
end
def method_missing(name, *args, &block)
@target.send(name, *args, &block)
end
end
n = Proxy.new(nil)
p nil ? 1 : 2 # 2
p n ? 1 : 2 # 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment