Created
December 14, 2018 16:58
-
-
Save sdball/f4f2be3ccedd3ab81eed4f826648b16a to your computer and use it in GitHub Desktop.
From whence nothing but nil can return
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 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