lib/gamebox/lib/inflector.rb
# Ordinalize turns a number into an ordinal string used to denote the
# position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
#
# Examples
#   ordinalize(1)     # => "1st"
#   ordinalize(2)     # => "2nd"
#   ordinalize(1002)  # => "1002nd"
#   ordinalize(1003)  # => "1003rd"
Ordinalize turns a number into an ordinal string used to denote the
position in an ordered sequence such as 1st, 2nd, 3rd, 4th.


Ordinalize turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st 2nd 3rd 4th .
def ordinalize(number)
    if (11..13).include?(number.to_i % 100)
      "#{number}th"
    else
      case number.to_i % 10
        when 1
           "#{number}st"
        when 2
           "#{number}nd"
        when 3
           "#{number}rd"
        else    "#{number}th"
      end
    end
  end
def ordinalize ( number ) if ( 11 .. 13 ) . include? ( number . to_i % 100 ) "#{number}th" else case number . to_i % 10 when 1 "#{number}st" when 2 "#{number}nd" when 3 "#{number}rd" else "#{number}th" end end end
Ordinalize turns a number into an ordinal string used to denote the
position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
Ordinalize turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st 2nd 3rd 4th .
number
<not_specific>