Sha256: 30a5dbcd9f8be46cfd313e58a8394f721aa684337fca37db33224084af4ceea4
Contents?: true
Size: 707 Bytes
Versions: 25
Compression:
Stored size: 707 Bytes
Contents
# frozen_string_literal: true { en: { number: { nth: { ordinals: lambda do |_key, number:, **_options| 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, number:, **_options| "#{number}#{ActiveSupport::Inflector.ordinal(number)}" end } } } }
Version data entries
25 entries across 23 versions & 5 rubygems