@@ -5501,20 +5501,30 @@ rb_ary_difference_multi(int argc, VALUE *argv, VALUE ary)
5501
5501
5502
5502
/*
5503
5503
* call-seq:
5504
- * array & other_array -> new_array
5504
+ * self & other_array -> new_array
5505
5505
*
5506
- * Returns a new +Array+ containing each element found in both +array+ and +Array+ +other_array+;
5507
- * duplicates are omitted; items are compared using <tt>eql?</tt>
5508
- * (items must also implement +hash+ correctly):
5506
+ * Returns a new +Array+ object containing the _intersection_ of +self+ and +other_array+;
5507
+ * that is, containing those elements found in both +self+ and +other_array+:
5509
5508
*
5510
5509
* [0, 1, 2, 3] & [1, 2] # => [1, 2]
5511
- * [0, 1, 0, 1] & [0, 1] # => [0, 1]
5512
5510
*
5513
- * Preserves order from +array+:
5511
+ * Omits duplicates:
5512
+ *
5513
+ * [0, 1, 1, 0] & [0, 1] # => [0, 1]
5514
+ *
5515
+ * Preserves order from +self+:
5514
5516
*
5515
5517
* [0, 1, 2] & [3, 2, 1, 0] # => [0, 1, 2]
5516
5518
*
5517
- * Related: Array#intersection.
5519
+ * Identifies common elements using method <tt>#eql?</tt>
5520
+ * (as defined in each element of +self+).
5521
+ *
5522
+ * Related:
5523
+ *
5524
+ * - Array#intersection: intersection of +self+ and multiple other arrays.
5525
+ * - Array#|: union of +self+ and one other array.
5526
+ * - Array#union: union of +self+ and multiple other arrays.
5527
+ *
5518
5528
*/
5519
5529
5520
5530
0 commit comments