diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 21:50:13 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 21:50:13 +0000 |
commit | cd0971e27f8da253918374e38c329fe709eed429 (patch) | |
tree | 933d802b5b59475290e54ee297106c6480669772 /array.c | |
parent | 9360721e5880fdeff4e72495991b3ffc8d94b190 (diff) |
* array.c (rb_ary_aref): Added a description of the behavior of
index positioning. [Bug #6680]
* array.c (rb_ary_aset): ditto. Reordered sentences for clarity.
* string.c (rb_str_aref_m): Added a description of the behavior of
index positioning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1016,7 +1016,9 @@ rb_ary_subseq(VALUE ary, long beg, long len) * elements, or returns a subarray specified by +range+ of indices. * * Negative indices count backward from the end of the array (-1 is the last - * element). + * element). For +start+ and +range+ cases the starting index is just before + * an element. Additionally, an empty array is returned when the starting + * index for an element range is at the end of the array. * * Returns +nil+ if the index (or starting index) are out of range. * @@ -1030,7 +1032,7 @@ rb_ary_subseq(VALUE ary, long beg, long len) * a[-3, 3] #=> [ "c", "d", "e" ] * # special cases * a[5] #=> nil - * a[6] #=> nil + * a[6, 1] #=> nil * a[5, 1] #=> [] * a[5..10] #=> [] * @@ -1436,8 +1438,11 @@ rb_ary_resize(VALUE ary, long len) * specified by the +range+ of indices. * * If indices are greater than the current capacity of the array, the array - * grows automatically. Negative indices will count backward from the end of - * the array. Inserts elements if +length+ is zero. + * grows automatically. Elements are inserted into the array at +start+ if + * +length+ is zero. + * + * Negative indices will count backward from the end of the array. For + * +start+ and +range+ cases the starting index is just before an element. * * An IndexError is raised if a negative index points past the beginning of * the array. |