instance method
ordinal
Ruby on Rails 6.1.7.10
Since v4.0.13Signature
ordinal(number)
Returns the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
ordinal(1) # => "st" ordinal(2) # => "nd" ordinal(1002) # => "nd" ordinal(1003) # => "rd" ordinal(-11) # => "th" ordinal(-1021) # => "st"
Parameters
-
numberreq
Source
# File activesupport/lib/active_support/inflector/methods.rb, line 347
def ordinal(number)
I18n.translate("number.nth.ordinals", number: number)
end
Defined in activesupport/lib/active_support/inflector/methods.rb line 347
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Inflector