Skip to content
instance method

Set#intersection

(::_Each[A]) -> self
intersection(p1)

Alias of #&

Returns a new set containing elements common to the set and the given enumerable object.

Example
Set[1, 3, 5] & Set[3, 2, 1]             #=> Set[3, 1]
Set['a', 'b', 'z'] & ['a', 'b', 'c']    #=> Set["a", "b"]
See also #& #intersect? #join #inspect also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0