Sha256: c6b2742a0c7328d2e7f359a272af079fcdb5fd8c125374b04a4aa77ee53bf416

Contents?: true

Size: 755 Bytes

Versions: 152

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

{
  en: {
    number: {
      nth: {
        ordinals: lambda do |_key, options|
          number = options[:number]
          case number
          when 1; "st"
          when 2; "nd"
          when 3; "rd"
          when 4, 5, 6, 7, 8, 9, 10, 11, 12, 13; "th"
          else
            num_modulo = number.to_i.abs % 100
            num_modulo %= 10 if num_modulo > 13
            case num_modulo
            when 1; "st"
            when 2; "nd"
            when 3; "rd"
            else    "th"
            end
          end
        end,

        ordinalized: lambda do |_key, options|
          number = options[:number]
          "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
        end
      }
    }
  }
}

Version data entries

152 entries across 146 versions & 18 rubygems

Version Path
activesupport-8.0.0 lib/active_support/locale/en.rb
activesupport-7.2.2 lib/active_support/locale/en.rb
activesupport-7.1.5 lib/active_support/locale/en.rb
activesupport-8.0.0.rc2 lib/active_support/locale/en.rb
activesupport-7.2.1.2 lib/active_support/locale/en.rb
activesupport-7.1.4.2 lib/active_support/locale/en.rb
activesupport-7.0.8.6 lib/active_support/locale/en.rb
activesupport-6.1.7.10 lib/active_support/locale/en.rb
activesupport-8.0.0.rc1 lib/active_support/locale/en.rb
activesupport-6.1.7.9 lib/active_support/locale/en.rb
activesupport-7.2.1.1 lib/active_support/locale/en.rb
activesupport-7.1.4.1 lib/active_support/locale/en.rb
activesupport-7.0.8.5 lib/active_support/locale/en.rb
activesupport-8.0.0.beta1 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha9 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha8 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha7 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha4 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha3 lib/active_support/locale/en.rb
omg-activesupport-8.0.0.alpha2 lib/active_support/locale/en.rb