Class Binding
In: lib/facet/binding/self.rb
lib/facet/binding/eval.rb
lib/facet/binding/called.rb
lib/facet/binding/caller.rb
lib/facet/binding/lineno.rb
lib/facet/binding/defined?.rb
lib/facet/binding/local_variables.rb
lib/facet/binding/delegate!.rb
Parent: Object

Methods

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

Public Instance methods

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

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.

All missing methods delegate to binding’s eval(self).

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"]

alias_method( :method_missing_without_delegate, :method_missing )

There is a lot of debate on what the hell to call this. method_name differs for 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]