字串以。結尾

要查詢字串是否以模式結尾,end_with? 方法會派上用場

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