Skip to content

Instantly share code, notes, and snippets.

@searls
Created October 2, 2021 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/ff8cf2a1ac0eaea281d4d0e4be086413 to your computer and use it in GitHub Desktop.
Save searls/ff8cf2a1ac0eaea281d4d0e4be086413 to your computer and use it in GitHub Desktop.
class Wtf
def method_missing(name, *args)
:lol
end
def respond_to?(name)
:nope
end
def respond_to_missing?(name)
:kek
end
end
puts "method_missing owner: #{Wtf.instance_method(:method_missing).owner}"
puts "respond_to? owner: #{Wtf.instance_method(:respond_to?).owner}"
puts "respond_to_missing? owner: #{Wtf.instance_method(:respond_to_missing?).owner}"
puts "instance_methods: #{Wtf.instance_methods.select { |m|
Wtf.instance_method(m).owner == Wtf
}}"
@al2o3cr
Copy link

al2o3cr commented Oct 2, 2021

respond_to_missing? is always set to private - found the spec for that.

@al2o3cr
Copy link

al2o3cr commented Oct 2, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment