Skip to content

Instantly share code, notes, and snippets.

@samnang
Created December 10, 2010 08:31
Show Gist options
  • Save samnang/735965 to your computer and use it in GitHub Desktop.
Save samnang/735965 to your computer and use it in GitHub Desktop.
Write your code here. Use binding method without using any variables or constants or define_singleton_method.
class A
@@a = 1
@a = 2
a = 3
singleton_class.send(:define_method, :bindings) { binding }
end
p eval('[@@a, @a, a]', A.bindings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment