概要
ordinal
詳細
ordinal について
ordinal
序数のサフィックスを取得します。
サンプル
# encoding: utf-8 require 'active_support/core_ext/integer/inflections' require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 1.ordinal 2.ordinal 3.ordinal 4.ordinal EOS __END__ ・下記はTbpgrUtils gemの機能 bulk_puts_eval https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
1.ordinal # => "st" 2.ordinal # => "nd" 3.ordinal # => "rd" 4.ordinal # => "th"