Check whether a string contains one of multiple substrings
[needle1, needle2].any? { |needle| haystack.include? needle }
Try parens in the expression:
haystack.include?(needle1) || haystack.include?(needle2)
You can do a regex match:
haystack.match? /needle1|needle2/
Or if your needles are in an array:
haystack.match? Regexp.union(needles)
(For Ruby < 2.4, use .match
without question mark.)