Sha256: b276c7331b7aedacb732d941d01f0e8263310352676e59eefd85a4542a2b516a

Contents?: true

Size: 659 Bytes

Versions: 22

Compression:

Stored size: 659 Bytes

Contents

require 'facets/core/binding/eval'
require 'facets/core/kernel/call_stack'

class Binding

  # Returns the call stack, in array format.
  def call_stack( level = 1 )
    eval( "call_stack( #{level} )" )
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCBinding < Test::Unit::TestCase

    def setup
      a = 1
      b = 2
      x = "hello"
      # the line number must be updated if it moves
      @bind = binding; @this_line_no = 25
    end

    def test_call_stack
      assert_instance_of( Array, @bind.call_stack )
    end

  end

=end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
facets-1.8.54 lib/facets/core/binding/call_stack.rb
facets-1.8.8 lib/facets/core/binding/call_stack.rb