[前][次][番号順一覧][スレッド一覧]

ruby-changes:44606

From: a_matsuda <ko1@a...>
Date: Wed, 9 Nov 2016 04:44:11 +0900 (JST)
Subject: [ruby-changes:44606] a_matsuda:r56679 (trunk): Update documentation of fetch

a_matsuda	2016-11-09 04:43:58 +0900 (Wed, 09 Nov 2016)

  New Revision: 56679

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56679

  Log:
    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@g...> (@lukaselmer)
    Signed-off-by: Akira Matsuda <ronnie@d...>
    
    closes #1472
    [ci skip]

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 56678)
+++ array.c	(revision 56679)
@@ -1382,8 +1382,9 @@ rb_ary_last(int argc, const VALUE *argv, https://github.com/ruby/ruby/blob/trunk/array.c#L1382
  *  +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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]