以下の内容はhttps://tbpgr.hatenablog.com/entry/20140218/1392729314より取得しました。


ActiveSupport | String#singularize

概要

String#singularize

詳細

String#singularize について

String#singularize

文字列の単数形を返却する。

サンプル

# encoding: utf-8
require 'active_support/core_ext/string/inflections'
require 'tbpgr_utils'

bulk_puts_eval binding, <<-EOS
'heads'.singularize
'bodies'.singularize
'people'.singularize
EOS

__END__
・下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

'heads'.singularize # => "head"
'bodies'.singularize # => "body"
'people'.singularize # => "person"



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140218/1392729314より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14