Skip to content

Instantly share code, notes, and snippets.

@sdball
Created December 14, 2018 16:58
Show Gist options
  • Save sdball/f4f2be3ccedd3ab81eed4f826648b16a to your computer and use it in GitHub Desktop.
Save sdball/f4f2be3ccedd3ab81eed4f826648b16a to your computer and use it in GitHub Desktop.
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