Skip to content
instance method

Set#intersect?

(::Set[A] | ::Enumerable[A]) -> bool
intersect?(set) → true or false

Returns true if the set and the given enumerable have at least one element in common.

Example
Set[1, 2, 3].intersect? Set[4, 5]   #=> false
Set[1, 2, 3].intersect? Set[3, 4]   #=> true
Set[1, 2, 3].intersect? 4..5        #=> false
Set[1, 2, 3].intersect? [3, 4]      #=> true
See also #inspect #intersection #init_with #join also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0