[DOC] Tweaks for Array.intersect? (#11744)

This commit is contained in:
Burdette Lamar 2024-10-02 10:12:01 -05:00 committed by GitHub
parent a7c04a317f
commit 609fdde2c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-10-02 15:12:18 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>

17
array.c
View File

@ -5767,19 +5767,16 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary)
/* /*
* call-seq: * call-seq:
* ary.intersect?(other_ary) -> true or false * intersect?(other_array) -> true or false
* *
* Returns +true+ if the array and +other_ary+ have at least one element in * Returns whether +other_array+ has at least one element that is +#eql?+ to some element of +self+:
* common, otherwise returns +false+:
* *
* a = [ 1, 2, 3 ] * [1, 2, 3].intersect?([3, 4, 5]) # => true
* b = [ 3, 4, 5 ] * [1, 2, 3].intersect?([4, 5, 6]) # => false
* c = [ 5, 6, 7 ]
* a.intersect?(b) #=> true
* a.intersect?(c) #=> false
* *
* +Array+ elements are compared using <tt>eql?</tt> * Each element must correctly implement method <tt>#hash</tt>.
* (items must also implement +hash+ correctly). *
* Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/ */
static VALUE static VALUE