Top Level Namespace
Defined Under Namespace
Modules: Fantasy Classes: Plugin
Instance Method Summary collapse
Instance Method Details
#ordinalize(number) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/plugins/datetime.rb', line 19 def ordinalize number if (11..13).include?(number % 100) "#{number}th" else case number % 10 when 1; "#{number}st" when 2; "#{number}nd" when 3; "#{number}rd" else "#{number}th" end end end |