I need to search over an array to find out which objects contain a specific string. The method must take two inputs.
This is a one-input method that works, and returns all objects with the letter t:
def my_array_finding_method(source)
source.grep(/t/)
end
my_array_finding_method(array)
This does not work:
def my_array_finding_method(source, thing_to_find)
source.grep(/thing_to_find/)
end
my_array_finding_method(array, "t")
I must modify the second bit of code to work. How can I do so?