Method: Functional::Tuple#intersect

Defined in:
lib/functional/tuple.rb

#intersect(other) ⇒ Functional::Tuple Also known as: &

Returns a new tuple containing elements common to the two tuples, excluding any duplicates. The order is preserved from the original tuple.

Parameters:

  • other (Array)

    the tuple or array-like object (responds to ‘to_a`) to operate on

Returns:



90
91
92
# File 'lib/functional/tuple.rb', line 90

def intersect(other)
  Tuple.new(@data & other.to_a)
end