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.
This commit is contained in:
Lukas Elmer
2016-11-02 19:45:43 +01:00
committed by GitHub
parent cc3f1b7f5c
commit f02694ecc7
+3 -2
View File
@@ -275,8 +275,9 @@ class Array
# +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