instance method
ordinal
Ruby on Rails 4.2.9
Since v4.0.13Signature
ordinal()
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"
Source
# File activesupport/lib/active_support/core_ext/integer/inflections.rb, line 26
def ordinal
ActiveSupport::Inflector.ordinal(self)
end
Defined in activesupport/lib/active_support/core_ext/integer/inflections.rb line 26
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Integer