* vm_eval.c: [DOC] [ci skip] Improve instance_eval description when given a
block or String arguments. By @nathanl via documenting-ruby/ruby#28 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
daca823c93
commit
602f7b5d82
@ -1,3 +1,8 @@
|
|||||||
|
Sun May 25 06:50:19 2014 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
|
* vm_eval.c: [DOC] Improve instance_eval description when given a
|
||||||
|
block or String arguments. By @nathanl via documenting-ruby/ruby#28
|
||||||
|
|
||||||
Sun May 25 06:29:39 2014 Zachary Scott <e@zzak.io>
|
Sun May 25 06:29:39 2014 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
* array.c: [DOC] Clarify default argument for Array.new.
|
* array.c: [DOC] Clarify default argument for Array.new.
|
||||||
|
22
vm_eval.c
22
vm_eval.c
@ -1595,24 +1595,34 @@ specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
|
|||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* obj.instance_eval(string [, filename [, lineno]] ) -> obj
|
* obj.instance_eval(string [, filename [, lineno]] ) -> obj
|
||||||
* obj.instance_eval {| | block } -> obj
|
* obj.instance_eval {|obj| block } -> obj
|
||||||
*
|
*
|
||||||
* Evaluates a string containing Ruby source code, or the given block,
|
* Evaluates a string containing Ruby source code, or the given block,
|
||||||
* within the context of the receiver (_obj_). In order to set the
|
* within the context of the receiver (_obj_). In order to set the
|
||||||
* context, the variable +self+ is set to _obj_ while
|
* context, the variable +self+ is set to _obj_ while
|
||||||
* the code is executing, giving the code access to _obj_'s
|
* the code is executing, giving the code access to _obj_'s
|
||||||
* instance variables. In the version of <code>instance_eval</code>
|
* instance variables and private methods.
|
||||||
* that takes a +String+, the optional second and third
|
*
|
||||||
* parameters supply a filename and starting line number that are used
|
* When <code>instance_eval</code> is given a block, _obj_ is also
|
||||||
* when reporting compilation errors.
|
* passed in as the block's only argument.
|
||||||
|
*
|
||||||
|
* When <code>instance_eval</code> is given a +String+, the optional
|
||||||
|
* second and third parameters supply a filename and starting line number
|
||||||
|
* that are used when reporting compilation errors.
|
||||||
*
|
*
|
||||||
* class KlassWithSecret
|
* class KlassWithSecret
|
||||||
* def initialize
|
* def initialize
|
||||||
* @secret = 99
|
* @secret = 99
|
||||||
* end
|
* end
|
||||||
|
* private
|
||||||
|
* def the_secret
|
||||||
|
* "Ssssh! The secret is #{@secret}."
|
||||||
|
* end
|
||||||
* end
|
* end
|
||||||
* k = KlassWithSecret.new
|
* k = KlassWithSecret.new
|
||||||
* k.instance_eval { @secret } #=> 99
|
* k.instance_eval { @secret } #=> 99
|
||||||
|
* k.instance_eval { the_secret } #=> "Ssssh! The secret is 99."
|
||||||
|
* k.instance_eval {|obj| obj == self } #=> true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user