string.include?(other_string) is used to check if a string contains another string. Is there a nice way to check if a string contains at least one string from an array of strings?
string_1 = "a monkey is an animal. dogs are fun"
arrays_of_strings_to_check_against = ['banana', 'fruit', 'animal', 'dog']
This would return true, because string_1 contains the string 'animal'. If we remove 'animal' from arrays_of_strings_to_check_against, it would return false.
Note that the string 'dog' from arrays_of_strings_to_check_against should not match 'dogs' from string_1, because it has to be a complete match.
I’m using Rails 3.2.0 and Ruby 1.9.2
Or even: