- []
- []
- []=
- []=
- __DIR__
- __DIR__
- __FILE__
- __FILE__
- __LINE__
- __LINE__
- __callee__
- __callee__
- __method__
- __method__
- caller
- caller
- callstack
- defined?
- defined?
- eval
- eval
- local_variables
- local_variables
- self
- self
Returns the value of some variable.
a = 2 binding["a"] #=> 2
[ show source ]
# File lib/core/facets/binding/opvars.rb, line 10 def []( x ) eval( x.to_s ) end
Returns the value of some variable.
a = 2 binding["a"] #=> 2
[ show source ]
# File lib/core/facets/binding/opvars.rb, line 10 def []( x ) eval( x.to_s ) end
Set the value of a local variable.
binding["a"] = 4 a #=> 4
[ show source ]
# File lib/core/facets/binding/opvars.rb, line 19 def []=( l, v ) eval( "lambda {|v| #{l} = v}").call( v ) end
Set the value of a local variable.
binding["a"] = 4 a #=> 4
[ show source ]
# File lib/core/facets/binding/opvars.rb, line 19 def []=( l, v ) eval( "lambda {|v| #{l} = v}").call( v ) end
Return the directory of the file.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 26 def __DIR__ eval("File.dirname(__FILE__)") end
Return the directory of the file.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 26 def __DIR__ eval("File.dirname(__FILE__)") end
Returns file name.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 20 def __FILE__ eval("__FILE__") end
Returns file name.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 20 def __FILE__ eval("__FILE__") end
Returns line number.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 14 def __LINE__ eval("__LINE__") end
Returns line number.
[ show source ]
# File lib/core/facets/binding/caller.rb, line 14 def __LINE__ eval("__LINE__") end
Retreive the current running method.
def tester; p called; end tester #=> :tester
[ show source ]
# File lib/core/facets/binding/caller.rb, line 36 def __callee__ name = /\`([^\']+)\'/.match(caller(1).first)[1] return name.to_sym end
Retreive the current running method.
def tester; p called; end tester #=> :tester
[ show source ]
# File lib/core/facets/binding/caller.rb, line 36 def __callee__ name = /\`([^\']+)\'/.match(caller(1).first)[1] return name.to_sym end
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.
def tester; p methodname; end tester #=> "tester"
[ show source ]
# File lib/core/facets/binding/caller.rb, line 48 def __method__ name = /\`([^\']+)\'/.match(caller(1).first)[1] return name end
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.
def tester; p methodname; end tester #=> "tester"
[ show source ]
# File lib/core/facets/binding/caller.rb, line 48 def __method__ name = /\`([^\']+)\'/.match(caller(1).first)[1] return name end
Returns the call stack, same format as Kernel#caller()
[ show source ]
# File lib/core/facets/binding/caller.rb, line 8 def caller( skip=0 ) eval("caller(#{skip})") end
Returns the call stack, same format as Kernel#caller()
[ show source ]
# File lib/core/facets/binding/caller.rb, line 8 def caller( skip=0 ) eval("caller(#{skip})") end
Returns the call stack, in array format.
[ show source ]
# File lib/core/facets/callstack.rb, line 47 def callstack(level=1) eval( "callstack( #{level} )" ) end
Returns the nature of something within the context of the binding. Returns nil if that thing is not defined.
[ show source ]
# File lib/core/facets/binding/defined.rb, line 8 def defined?(x) eval("defined? #{x}") end
Returns the nature of something within the context of the binding. Returns nil if that thing is not defined.
[ show source ]
# File lib/core/facets/binding/defined.rb, line 8 def defined?(x) eval("defined? #{x}") end
Evaluate a Ruby source code string (or block) in the binding context.
[ show source ]
# File lib/core/facets/binding/eval.rb, line 7 def eval(str) #='', &blk ) #if block_given? # Kernel.eval( self, &blk ) #elsif str Kernel.eval(str, self) #end end
Evaluate a Ruby source code string (or block) in the binding context.
[ show source ]
# File lib/core/facets/binding/eval.rb, line 7 def eval(str) #='', &blk ) #if block_given? # Kernel.eval( self, &blk ) #elsif str Kernel.eval(str, self) #end end
Returns the local variables defined in the binding context
a = 2 binding.local_variables #=> ["a"]
[ show source ]
# File lib/core/facets/binding/local_variables.rb, line 10 def local_variables() eval("local_variables") end
Returns the local variables defined in the binding context
a = 2 binding.local_variables #=> ["a"]
[ show source ]
# File lib/core/facets/binding/local_variables.rb, line 10 def local_variables() eval("local_variables") end
Returns self of the binding context.
[ show source ]
# File lib/core/facets/binding/self.rb, line 7 def self() @_self ||= eval("self") end
Returns self of the binding context.
[ show source ]
# File lib/core/facets/binding/self.rb, line 7 def self() @_self ||= eval("self") end