aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authora_matsuda <a_matsuda@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-08 19:43:58 +0000
committera_matsuda <a_matsuda@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-08 19:43:58 +0000
commit15a88c56a25452d99f182dcd1b2589093cc4d786 (patch)
treeb1b2cb80888679affd3861482321046c9ebaf864 /array.c
parent1ad7fb2f32846ad0a71b66547152fd9511aa2292 (diff)
downloadruby-15a88c56a25452d99f182dcd1b2589093cc4d786.tar.gz
Update documentation of fetch
The sentence `Negative values of +index+ count from the end of the array.` can be interpreted that it only holds if a block is given. Clarify it. Patch by: Lukas Elmer <lukas.elmer@gmail.com> (@lukaselmer) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1472 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/array.c b/array.c
index a0cfb214a4..b99ab450a7 100644
--- a/array.c
+++ b/array.c
@@ -1382,8 +1382,9 @@ rb_ary_last(int argc, const VALUE *argv, VALUE ary)
* +default+ value.
*
* Alternatively, if a block is given it will only be executed when an
- * invalid +index+ is referenced. Negative values of +index+ count from the
- * end of the array.
+ * invalid +index+ is referenced.
+ *
+ * Negative values of +index+ count from the end of the array.
*
* a = [ 11, 22, 33, 44 ]
* a.fetch(1) #=> 22