Created
February 8, 2012 03:56
-
-
Save jkutner/1765228 to your computer and use it in GitHub Desktop.
Is there a way to catch the :my_val method inside the Local class without defining it?
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 Local | |
def method_missing(*args) | |
"hello world" | |
end | |
end | |
def my_val | |
raise "goodbye cruel world" | |
end | |
Local.new.instance_eval { p my_val } # raises error, but i want to print "hello world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment