Skip to content

Instantly share code, notes, and snippets.

@manveru
Created March 22, 2011 07:57
Show Gist options
  • Save manveru/880907 to your computer and use it in GitHub Desktop.
Save manveru/880907 to your computer and use it in GitHub Desktop.
Binding::of_caller for Rubinius
class Binding
def self.of_caller
bt = Rubinius::VM.backtrace(2, true).first
Binding.setup(
bt.variables,
bt.variables.method,
bt.static_scope
)
end
end
def f
Binding.of_caller.eval('x')
end
x = 33
p f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment