If you are comparing two different arrays (instead of one against itself) a very fast way is to use the intersect operator &
provided by Ruby's Array class.
# Given
a = ['a', 'b', 'c', 'd']
b = ['e', 'f', 'c', 'd']
# Then this...
a & b # => ['c', 'd']