Sha256: e7cb9eed9d7d24445e8f69a8326a2e9206af8061b57e60d8016a4fa20db82241

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

require './binding_of_caller'

outer = 10

class Z
  def z
    u = 10
    A.new.a
  end
end

class A
  def a
    y = 10
    B.new.b
  end
end

class B
  def b
    x = 10
    puts binding_of_caller(0).eval('local_variables')
    puts binding_of_caller(1).eval('local_variables')
    puts binding_of_caller(2).eval('local_variables')
    puts binding_of_caller(3).eval('local_variables')
    puts binding_of_caller(400).eval('local_variables')
  end
end

def a; b; end; def b; binding_of_caller(10); end; a;

# Z.new.z

# output:
# => x
# => y
# => u
# => outer
# Exception

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binding_of_caller-0.3.0 ext/binding_of_caller/example.rb