Skip to content

Instantly share code, notes, and snippets.

@sdball
Created December 14, 2018 16:58
Embed
What would you like to do?
From whence nothing but nil can return
class Nilbog
class_eval do
Object.methods.each do |method|
class_eval("def #{method}; #{nil}; end")
end
end
def method_missing(_)
nil
end
end
p Nilbog.new.object_id # => nil
p Nilbog.new.to_s # => nil
p Nilbog.new.hello? # => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment