[DOC] Tweaks for Array#intersection (#11745)

This commit is contained in:
Burdette Lamar 2024-10-02 10:11:29 -05:00 коммит произвёл GitHub
Родитель 75ab01f3b7
Коммит a7c04a317f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 9 добавлений и 9 удалений

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

@ -5624,23 +5624,23 @@ rb_ary_and(VALUE ary1, VALUE ary2)
/*
* call-seq:
* array.intersection(*other_arrays) -> new_array
* intersection(*other_arrays) -> new_array
*
* Returns a new +Array+ containing each element found both in +self+
* and in all of the given Arrays +other_arrays+;
* duplicates are omitted; items are compared using <tt>eql?</tt>
* (items must also implement +hash+ correctly):
* Returns a new array containing each element in +self+ that is +#eql?+
* to at least one element in each of the given +other_arrays+;
* duplicates are omitted:
*
* [0, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
* [0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
*
* Preserves order from +self+:
* Each element must correctly implement method <tt>#hash</tt>.
*
* Order from +self+ is preserved:
*
* [0, 1, 2].intersection([2, 1, 0]) # => [0, 1, 2]
*
* Returns a copy of +self+ if no arguments given.
* Returns a copy of +self+ if no arguments are given.
*
* Related: Array#&.
* Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE