Method: Enumerable#intersect

Defined in:
lib/jinx/helpers/enumerable.rb

#intersect(other) ⇒ Object Also known as: &

Returns an Enumerable which iterates over items in this Enumerable which are also in the other Enumerable.

Returns:

  • an Enumerable which iterates over items in this Enumerable which are also in the other Enumerable



189
190
191
# File 'lib/jinx/helpers/enumerable.rb', line 189

def intersect(other)
  filter { |item| other.include?(item) }
end