Skip to content

Instantly share code, notes, and snippets.

@codesword
Created June 5, 2016 12:29
Show Gist options
  • Save codesword/374257f0b3c6e643371f7373ca219a6f to your computer and use it in GitHub Desktop.
Save codesword/374257f0b3c6e643371f7373ca219a6f to your computer and use it in GitHub Desktop.
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