Sha256: ffd65b5e48afb3fc1734e81e1c60e0857fe9bd89d8dd491927bfc0d1143d5799

Contents?: true

Size: 820 Bytes

Versions: 7

Compression:

Stored size: 820 Bytes

Contents

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

class Binding

  # Returns the call stack, same format as Kernel#caller()
  #
  def caller( skip=0 )
    eval("caller(#{skip})")
  end

  # Return the line number on which the binding was created.
  #
  def __LINE__
    Kernel.eval("__LINE__", self)
  end

  # Returns file name in which the binding was created.
  #
  def __FILE__
    Kernel.eval("__FILE__", self)
  end

  # Return the directory of the file in which the binding was created.
  #
  def __DIR__  
    File.dirname(self.__FILE__)
  end

  # Retreive the current running method.
  #
  def __method__
    Kernel.eval("__method__", self)
  end

  # Retreive the current running method.
  #
  def __callee__
    Kernel.eval("__callee__", self)
  end

end

Version data entries

7 entries across 6 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/binding/caller.rb
facets-2.9.2 lib/core/facets/binding/caller.rb
facets-2.9.2 src/core/facets/binding/caller.rb
facets-2.9.1 lib/core/facets/binding/caller.rb
facets-2.9.0 lib/core/facets/binding/caller.rb
facets-2.9.0.pre.2 lib/core/facets/binding/caller.rb
facets-2.9.0.pre.1 lib/core/facets/binding/caller.rb