Ruby 3.0.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Symbolクラス > end_with?

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