Forums » Ruby on Rails » Ruby Set intersection
Get all the elements that two arrays have in common with the ampersand operator (&).


[ 1, 1, 3, 5 ] & [ 1, 2, 3 ] # => [1, 3]