Module: NumbersAndWords::I18n::Plurals::Ru

Extended by:
Ru
Included in:
Ru
Defined in:
lib/numbers_and_words/i18n/plurals/ru.rb

Constant Summary collapse

RULE =
lambda do |n|
   one_conditions(n) ?
    :one : few_conditions(n) ?
      :few : many_conditions(n) ?
        :many : :other
end

Instance Method Summary collapse

Instance Method Details

#few_conditions(n) ⇒ Object



18
19
20
# File 'lib/numbers_and_words/i18n/plurals/ru.rb', line 18

def few_conditions n
  [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100)
end

#many_conditions(n) ⇒ Object



22
23
24
# File 'lib/numbers_and_words/i18n/plurals/ru.rb', line 22

def many_conditions n
  n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100)
end

#one_conditions(n) ⇒ Object



14
15
16
# File 'lib/numbers_and_words/i18n/plurals/ru.rb', line 14

def one_conditions n
  n % 10 == 1 && n % 100 != 11
end