Class Binding
In: lib/facet/binding/%5B%5D%3D.rb
lib/facet/binding/self.rb
lib/facet/binding/filename.rb
lib/facet/binding/%5B%5D.rb
lib/facet/binding/eval.rb
lib/facet/binding/method_name.rb
lib/facet/binding/defined%3F.rb
lib/facet/binding/called.rb
lib/facet/binding/caller.rb
lib/facet/binding/lineno.rb
lib/facet/binding/local_variables.rb
Parent: Object

Methods

[]   []   []=   []=   called   caller   defined?   eval   filename   lineno   local_variables   method_name   self  

Public Instance methods

Returns the value of some variable.

  require 'facet/binding/local_variables'

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

Returns the value of some variable.

  require 'facet/binding/local_variables'

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

Set the value of a local variable.

  require 'facet/binding/local_variables'

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

Set the value of a local variable.

  require 'facet/binding/local_variables'

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

Retreive the current running method.

  require 'facet/binding/called'

  def tester; p called; end
  tester  #=> :tester

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

Returns the nature of something, nil if that thing is not defined.

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

returns file name

returns line number

Returns the local variables defined in the binding context

  require 'facet/binding/local_variables'

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

There is a lot of debate on what to call this. method_name differs from called only by the fact that it returns a string, rather then a symbol.

  require 'facet/binding/called'

  def tester; p method_name; end
  tester  #=> "tester"

Returns the self in the binding context.

[Validate]