Skip to content

Commit 609fdde

Browse files
[DOC] Tweaks for Array.intersect? (#11744)
1 parent a7c04a3 commit 609fdde

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

array.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5767,19 +5767,16 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary)
57675767

57685768
/*
57695769
* call-seq:
5770-
* ary.intersect?(other_ary) -> true or false
5770+
* intersect?(other_array) -> true or false
57715771
*
5772-
* Returns +true+ if the array and +other_ary+ have at least one element in
5773-
* common, otherwise returns +false+:
5772+
* Returns whether +other_array+ has at least one element that is +#eql?+ to some element of +self+:
57745773
*
5775-
* a = [ 1, 2, 3 ]
5776-
* b = [ 3, 4, 5 ]
5777-
* c = [ 5, 6, 7 ]
5778-
* a.intersect?(b) #=> true
5779-
* a.intersect?(c) #=> false
5774+
* [1, 2, 3].intersect?([3, 4, 5]) # => true
5775+
* [1, 2, 3].intersect?([4, 5, 6]) # => false
57805776
*
5781-
* +Array+ elements are compared using <tt>eql?</tt>
5782-
* (items must also implement +hash+ correctly).
5777+
* Each element must correctly implement method <tt>#hash</tt>.
5778+
*
5779+
* Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
57835780
*/
57845781

57855782
static VALUE

0 commit comments

Comments
 (0)