1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2014-07-27 21:38:23 +00:00
parent 60272f90fd
commit 57541c4986
2 changed files with 15 additions and 14 deletions

View file

@ -1,3 +1,7 @@
Mon Jul 28 06:37:19 2014 Zachary Scott <e@zzak.io>
* vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]
Mon Jul 28 06:34:43 2014 Zachary Scott <e@zzak.io> Mon Jul 28 06:34:43 2014 Zachary Scott <e@zzak.io>
* vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catch * vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catch

View file

@ -1782,30 +1782,27 @@ catch_i(VALUE tag, VALUE data)
* call-seq: * call-seq:
* catch([tag]) {|tag| block } -> obj * catch([tag]) {|tag| block } -> obj
* *
* +catch+ executes its block. If +throw+ is not called, * +catch+ executes its block. If +throw+ is not called, the block executes
* the block executes normally, and +catch+ returns the * normally, and +catch+ returns the value of the last expression evaluated.
* value of the last expression evaluated.
* *
* catch(1) { 123 } # => 123 * catch(1) { 123 } # => 123
* *
* If +throw(tag2, val)+ is called, Ruby searches up its * If +throw(tag2, val)+ is called, Ruby searches up its stack for a +catch+
* stack for a +catch+ block whose _tag_ has the same * block whose +tag+ has the same +object_id+ as _tag2_. When found, the block
* +object_id+ as _tag2_. If found, the block stops * stops executing and returns _val_ (or +nil+ if no second argument was given
* executing and returns _val_ (or +nil+ if no second * to +throw+).
* argument was given to +throw+).
* *
* catch(1) { throw(1, 456) } # => 456 * catch(1) { throw(1, 456) } # => 456
* catch(1) { throw(1) } # => nil * catch(1) { throw(1) } # => nil
* *
* When _tag_ is passed as the first argument, +catch+ * When +tag+ is passed as the first argument, +catch+ yields it as the
* yields it as the parameter of the block. * parameter of the block.
* *
* catch(1) {|x| x + 2 } # => 3 * catch(1) {|x| x + 2 } # => 3
* *
* When no _tag_ is given, +catch+ yields a new unique * When no +tag+ is given, +catch+ yields a new unique object (as from
* object (as from +Object.new+) as the block parameter. * +Object.new+) as the block parameter. This object can then be used as the
* This object can then be used as the argument to * argument to +throw+, and will match the correct +catch+ block.
* +throw+, and will match the correct +catch+ block.
* *
* catch do |obj_A| * catch do |obj_A|
* catch do |obj_B| * catch do |obj_B|