Created
June 5, 2016 12:29
-
-
Save codesword/374257f0b3c6e643371f7373ca219a6f to your computer and use it in GitHub Desktop.
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 Person | |
def initialize(n) | |
@name = n | |
end | |
def issues | |
family = "No Money" | |
relationship = "Complex" | |
friends = "No Friends" | |
binding | |
end | |
def get_binding | |
binding | |
end | |
end | |
aboki = Person.new("Aboki") | |
aboki_binding = aboki.get_binding | |
aboki_issue_binding = aboki.issues | |
T | |
eval("@name", aboki_binding) #=> "Aboki" | |
eval("@name", aboki_issue_binding) #=> "Aboki" | |
eval("family", aboki_issue_binding) #=> "No Money" | |
eval("relationship", aboki_issue_binding) #=> "Complex" | |
aboki_issue_binding.local_variable_get(:friends) #=> "No Friends" | |
eval("family", aboki_binding) #=> undefined local variable or method `family' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment