Sha256: 0f9677c71ba8088f9ff5b1224301991e237cfd3d88a048833e7716b246da1bb3

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

require 'facets/binding/eval'
require 'facets/binding/callstack'

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 __callee__
    Kernel.eval("__callee__", self)
  end

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/binding/caller.rb
facets-2.8.3 lib/core/facets/binding/caller.rb
facets-2.8.2 lib/core/facets/binding/caller.rb