Module: Pagy::I18n::P11n::Arabic

Defined in:
lib/pagy/modules/i18n/p11n/arabic.rb

Class Method Summary collapse

Class Method Details

.plural_for(n = 0) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pagy/modules/i18n/p11n/arabic.rb', line 9

def plural_for(n = 0)
  mod100 = n % 100

  case
  when n == 0  # rubocop:disable Style/NumericPredicate
    :zero
  when n == 1
    :one
  when n == 2
    :two
  when (3..10).to_a.include?(mod100)
    :few
  when (11..99).to_a.include?(mod100)
    :many
  else
    :other
  end
end