Skip to content

Instantly share code, notes, and snippets.

@jkutner
Created February 8, 2012 03:56
Show Gist options
  • Save jkutner/1765228 to your computer and use it in GitHub Desktop.
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?
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