Method: Integer#ordinal

Defined in:
lib/active_support/core_ext/integer/inflections.rb

#ordinalObject

Ordinal returns the suffix used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

1.ordinal     # => "st"
2.ordinal     # => "nd"
1002.ordinal  # => "nd"
1003.ordinal  # => "rd"
-11.ordinal   # => "th"
-1001.ordinal # => "st"


28
29
30
# File 'lib/active_support/core_ext/integer/inflections.rb', line 28

def ordinal
  ActiveSupport::Inflector.ordinal(self)
end