From: Burdette Lamar Date: Wed, 2 Oct 2024 15:12:01 +0000 (-0500) Subject: [DOC] Tweaks for Array.intersect? (#11744) X-Git-Tag: v3_4_0_preview2~98 X-Git-Url: https://repo.or.cz/ruby.git/commitdiff_plain/609fdde2c99ad6b59a05808b96886bb6b71f3b8d [DOC] Tweaks for Array.intersect? (#11744) --- diff --git a/array.c b/array.c index b85069a599..103658f783 100644 --- a/array.c +++ b/array.c @@ -5767,19 +5767,16 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary) /* * 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 - * common, otherwise returns +false+: + * Returns whether +other_array+ has at least one element that is +#eql?+ to some element of +self+: * - * a = [ 1, 2, 3 ] - * b = [ 3, 4, 5 ] - * c = [ 5, 6, 7 ] - * a.intersect?(b) #=> true - * a.intersect?(c) #=> false + * [1, 2, 3].intersect?([3, 4, 5]) # => true + * [1, 2, 3].intersect?([4, 5, 6]) # => false * - * +Array+ elements are compared using eql? - * (items must also implement +hash+ correctly). + * Each element must correctly implement method #hash. + * + * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying]. */ static VALUE