
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
