Ruby 3.4 リファレンスマニュアル

instance method Symbol#end_with?

end_with?(*suffixes) -> boolRuby 2.7.0 から[permalink][rdoc][edit]

self の末尾が suffixes のいずれかであるとき true を返します。

(self.to_s.end_with?と同じです。)

[PARAM] suffixes:
パターンを表す文字列 (のリスト)

[SEE_ALSO] Symbol#start_with?

[SEE_ALSO] String#end_with?

p :hello.end_with?("ello")             #=> true

# returns true if one of the +suffixes+ matches.
p :hello.end_with?("heaven", "ello")   #=> true
p :hello.end_with?("heaven", "paradise") #=> false