-
-
Save 0x0dea/951145cfe4b402a2fb9d to your computer and use it in GitHub Desktop.
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 Foo | |
def self.const_missing const | |
const | |
end | |
def method_missing *args | |
p FOO | |
args | |
end | |
end | |
p Foo.new.instance_exec { foo 1, 2, 3 } | |
p Foo.new.instance_exec { FOO } | |
# :FOO | |
# [:foo, 1, 2, 3] | |
# foo.rb:13:in `block in <main>': uninitialized constant FOO (NameError) | |
# from foo.rb:13:in `instance_exec' | |
# from foo.rb:13:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment