このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

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

instance method Symbol#end_with?

end_with?(*suffixes) -> bool[permalink][rdoc]

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

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

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

[SEE_ALSO] Symbol#start_with?

[SEE_ALSO] String#end_with?

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

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