This commit is contained in:
BurdetteLamar 2024-08-15 16:00:18 +01:00 коммит произвёл Peter Zhu
Родитель 5cb6954baa
Коммит 33bffde923
1 изменённых файлов: 16 добавлений и 4 удалений

20
array.c
Просмотреть файл

@ -1919,13 +1919,25 @@ rb_ary_aref1(VALUE ary, VALUE arg)
/*
* call-seq:
* array.at(index) -> object
* at(index) -> object or nil
*
* Returns the element of +self+ specified by the given +index+
* or +nil+ if there is no such element;
* +index+ must be an
* {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
*
* For non-negative +index+, returns the element of +self+ at offset +index+:
*
* Returns the element at Integer offset +index+; does not modify +self+.
* a = [:foo, 'bar', 2]
* a.at(0) # => :foo
* a.at(2) # => 2
* a.at(0) # => :foo
* a.at(2) # => 2
* a.at(2.0) # => 2
*
* For negative +index+, counts backwards from the end of +self+:
*
* a.at(-2) # => "bar"
*
* Related: Array#[].
*/
VALUE