Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Set#intersect?

intersect?(set)

Returns true if the set and the given set 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
See also #inspect #intersection #initialize_dup #join also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1