To find if a string ends with a pattern, the end_with? method comes in handy

str = "I like pineapples"
str.end_with?("pineaaples")      => false