Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created December 4, 2014 20:45
Show Gist options
  • Select an option

  • Save ConradIrwin/04270b6afbe73e66e16a to your computer and use it in GitHub Desktop.

Select an option

Save ConradIrwin/04270b6afbe73e66e16a to your computer and use it in GitHub Desktop.
require 'debug_inspector'
def a(a)
b(1)
end
def b(b)
c(2)
end
def c(c)
RubyVM::DebugInspector.open do |i|
n = 0
loop do
begin
b = i.frame_binding(n)
rescue ArgumentError
break
end
if b
puts(b.eval("local_variables").each_with_object({}) do |v, h|
h[v] = b.local_variable_get(v)
end)
end
n += 1
end
end
end
a(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment