I am working on a ruby challenge requesting that I create a method that inputs an array of strings and separates the strings into 3 categories returned as symbols. These symbols will return in an array.
If the string contains the word "cat", then it returns the symbol
If "dog", then it returns
If the string does not contain "dog" or "cat" it returns the symbol
So far I have the following code but having trouble getting it to pass.
def pets (house) if house.include?/(?i:cat)/ :cat = house elsif house.include?/(?i:dog)/ :dog = house else :none = house end end
input = [ "We have a dog", "Cat running around!", "All dOgS bark", "Nothing to see here", nil ]
It should return
[ :dog, :cat, :dog, :none, :none ]