Project

General

Profile

Bug #13132 ยป doc_binding.patch

stomar (Marcus Stollsteimer), 01/15/2017 04:09 PM

View differences:

proc.c
* environment. See also the description of class +Binding+.
*
* def get_binding(param)
* return binding
* binding
* end
* b = get_binding("hello")
* eval("param", b) #=> "hello"
......
* reporting syntax errors.
*
* def get_binding(param)
* return binding
* binding
* end
* b = get_binding("hello")
* b.eval("param") #=> "hello"
......
* call-seq:
* binding.local_variables -> Array
*
* Returns the +symbol+ names of the binding's local variables
* Returns the names of the binding's local variables as symbols.
*
* def foo
* a = 1
......
* end
* end
*
* This method is short version of the following code.
* This method is the short version of the following code:
*
* binding.eval("local_variables")
*
......
* call-seq:
* binding.local_variable_get(symbol) -> obj
*
* Returns a +value+ of local variable +symbol+.
* Returns the value of the local variable +symbol+.
*
* def foo
* a = 1
......
* binding.local_variable_get(:b) #=> NameError
* end
*
* This method is short version of the following code.
* This method is the short version of the following code:
*
* binding.eval("#{symbol}")
*
......
* bind = binding
* bind.local_variable_set(:a, 2) # set existing local variable `a'
* bind.local_variable_set(:b, 3) # create new local variable `b'
* # `b' exists only in binding.
* p bind.local_variable_get(:a) #=> 2
* p bind.local_variable_get(:b) #=> 3
* p a #=> 2
* p b #=> NameError
* # `b' exists only in binding
*
* p bind.local_variable_get(:a) #=> 2
* p bind.local_variable_get(:b) #=> 3
* p a #=> 2
* p b #=> NameError
* end
*
* This method is a similar behavior of the following code
* This method behaves similarly to the following code:
*
* binding.eval("#{symbol} = #{obj}")
*
* if obj can be dumped in Ruby code.
* if +obj+ can be dumped in Ruby code.
*/
static VALUE
bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
......
* call-seq:
* binding.local_variable_defined?(symbol) -> obj
*
* Returns a +true+ if a local variable +symbol+ exists.
* Returns +true+ if a local variable +symbol+ exists.
*
* def foo
* a = 1
......
* binding.local_variable_defined?(:b) #=> false
* end
*
* This method is short version of the following code.
* This method is the short version of the following code:
*
* binding.eval("defined?(#{symbol}) == 'local-variable'")
*
......
* prc.source_location -> [String, Integer]
*
* Returns the Ruby source filename and line number containing this proc
* or +nil+ if this proc was not defined in Ruby (i.e. native)
* or +nil+ if this proc was not defined in Ruby (i.e. native).
*/
VALUE
......
* meth.source_location -> [String, Integer]
*
* Returns the Ruby source filename and line number containing this method
* or nil if this method was not defined in Ruby (i.e. native)
* or nil if this method was not defined in Ruby (i.e. native).
*/
VALUE
......
* @secret = n
* end
* def get_binding
* return binding()
* binding
* end
* end
*
    (1-1/1)