Sha256: f01c8cfcfa6a7a358b58a4dc63c35f7a864ad05814da061987218d62cfa2cc18

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

require 'facet/binding/eval'
require 'facet/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

3 entries across 3 versions & 1 rubygems

Version Path
facets-1.0.0 lib/facet/binding/call_stack.rb
facets-1.0.3 packages/core/lib/facet/binding/call_stack.rb
facets-1.1.0 lib/facet/binding/call_stack.rb