概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: Ruby 2.5 added delete_prefix and delete_suffix methods 原文公開日: 2017/11/28 著者: Amit Choudhary サイト: BigBinary Blog 本記事は、BigBinaryのRuby 2.5シリーズのひとつです。 先ごろRuby 2.5.0-preview1がリリースされました。 Ruby 2.4の場合 Projects::CategoriesControllerという文字列があり、Controllerという文字を削除したいとします。このような場合は#chompメソッドを使えます。 irb> "Projects::CategoriesController".chomp("Controller") => "Projects::Categories" しか
![Ruby 2.5新メソッド: #delete_prefix と #delete_suffix(翻訳)|TechRacho by BPS株式会社](https://cdn-ak-scissors.b.st-hatena.com/image/square/637b0fda5b480d61092a4b2cbfe311d55d1b38cf/height=288;version=1;width=512/https%3A%2F%2Ftechracho.bpsinc.jp%2Fwp-content%2Fuploads%2F2017%2F12%2Fruby2.5_eyecatch.png)