Created
November 15, 2011 02:00
-
-
Save brianstorti/1365895 to your computer and use it in GitHub Desktop.
this_var
This file contains hidden or 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 Class | |
def method_missing(name, *args) | |
name = name.to_s | |
if name =~ /this/ | |
name["this_"] = "" | |
eval("@#{name}") | |
end | |
end | |
end | |
class A | |
@var = "abc" | |
def self.test | |
this_var | |
end | |
end | |
puts A.test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment