Class Binding
In: lib/facets/core/facets/kernel/call_stack.rb
lib/facets/core/facets/binding/defined.rb
lib/facets/core/facets/binding/self.rb
lib/facets/core/facets/binding/op.rb
lib/facets/core/facets/binding/caller.rb
lib/facets/core/facets/binding/eval.rb
lib/facets/core/facets/binding/local_variables.rb
Parent: Object

Methods

[]   []=   __DIR__   __FILE__   __LINE__   __callee__   __method__   call_stack   caller   callstack   defined?   eval   local_variables   self  

Public Instance methods

Returns the value of some variable.

  a = 2
  binding["a"]  #=> 2

[Source]

# File lib/facets/core/facets/binding/op.rb, line 10
  def []( x )
    eval( x.to_s )
  end

Set the value of a local variable.

  binding["a"] = 4
  a  #=> 4

[Source]

# File lib/facets/core/facets/binding/op.rb, line 19
  def []=( l, v )
    eval( "lambda {|v| #{l} = v}").call( v )
  end

Return the directory of the file in which the binding was created.

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 27
  def __DIR__  
    File.dirname(self.__FILE__)
  end

Returns file name in which the binding was created.

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 21
  def __FILE__
    Kernel.eval("__FILE__", self)
  end

Return the line number on which the binding was created.

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 15
  def __LINE__
    Kernel.eval("__LINE__", self)
  end

Retreive the current running method.

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 39
  def __callee__
    Kernel.eval("__callee__", self)
  end

Retreive the current running method.

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 33
  def __method__
    Kernel.eval("__method__", self)
  end

Returns the call stack, in array format.

[Source]

# File lib/facets/core/facets/kernel/call_stack.rb, line 50
  def call_stack(level=1)
    eval( "callstack( #{level} )" )
  end

Returns the call stack, same format as Kernel#caller()

[Source]

# File lib/facets/core/facets/binding/caller.rb, line 9
  def caller( skip=0 )
    eval("caller(#{skip})")
  end
callstack(level=1)

Alias for call_stack

Returns the nature of something within the context of the binding. Returns nil if that thing is not defined.

[Source]

# File lib/facets/core/facets/binding/defined.rb, line 7
  def defined?(x)
    eval("defined? #{x}")
  end

Evaluate a Ruby source code string (or block) in the binding context.

[Source]

# File lib/facets/core/facets/binding/eval.rb, line 7
    def eval(str)
      Kernel.eval(str, self)
    end

Returns the local variables defined in the binding context:

  a = 1
  b = 2

  binding.local_variables  #=> [:a, :b]

[Source]

# File lib/facets/core/facets/binding/local_variables.rb, line 12
  def local_variables()
    eval("local_variables")
  end

Returns self of the binding context.

[Source]

# File lib/facets/core/facets/binding/self.rb, line 7
  def self()
    @_self ||= eval("self")
  end

[Validate]