зеркало из https://github.com/github/ruby.git
[DOC] Tweaks for Array#intersection (#11745)
This commit is contained in:
Родитель
75ab01f3b7
Коммит
a7c04a317f
18
array.c
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче