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


ActiveSupport | ordinalize

概要

ordinalize

詳細

ordinalize について

ordinalize

数値を序数のサフィックス付きのフォーマットにします。

サンプル

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

I18n.enforce_available_locales = true
bulk_puts_eval binding, <<-EOS
1.ordinalize
2.ordinalize
3.ordinalize
4.ordinalize
EOS

__END__
・下記はTbpgrUtils gemの機能
bulk_puts_eval

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

出力

1.ordinalize # => "1st"
2.ordinalize # => "2nd"
3.ordinalize # => "3rd"
4.ordinalize # => "4th"



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

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