Skip to content

Commit 2b98545

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Tweaks for Array#union
1 parent 2078ba1 commit 2b98545

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

array.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5658,18 +5658,25 @@ rb_ary_or(VALUE ary1, VALUE ary2)
56585658

56595659
/*
56605660
* call-seq:
5661-
* array.union(*other_arrays) -> new_array
5661+
* union(*other_arrays) -> new_array
56625662
*
5663-
* Returns a new +Array+ that is the union of +self+ and all given Arrays +other_arrays+;
5664-
* duplicates are removed; order is preserved; items are compared using <tt>eql?</tt>:
5663+
* Returns a new array that is the union of the elements of +self+
5664+
* and all given arrays +other_arrays+;
5665+
* items are compared using <tt>eql?</tt>:
56655666
*
56665667
* [0, 1, 2, 3].union([4, 5], [6, 7]) # => [0, 1, 2, 3, 4, 5, 6, 7]
5668+
*
5669+
* Removes duplicates (preserving the first found):
5670+
*
56675671
* [0, 1, 1].union([2, 1], [3, 1]) # => [0, 1, 2, 3]
5668-
* [0, 1, 2, 3].union([3, 2], [1, 0]) # => [0, 1, 2, 3]
56695672
*
5670-
* Returns a copy of +self+ if no arguments given.
5673+
* Preserves order (preserving the position of the first found):
56715674
*
5672-
* Related: Array#|.
5675+
* [3, 2, 1, 0].union([5, 3], [4, 2]) # => [3, 2, 1, 0, 5, 4]
5676+
*
5677+
* With no arguments given, returns a copy of +self+.
5678+
*
5679+
* Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
56735680
*/
56745681

56755682
static VALUE

0 commit comments

Comments
 (0)