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

Defined in:
lib/numbers_and_words/i18n/plurals/ru.rb

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.few_conditions(n) ⇒ Object



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

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

.many_conditions(n) ⇒ Object



27
28
29
# File 'lib/numbers_and_words/i18n/plurals/ru.rb', line 27

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

.one_conditions(n) ⇒ Object



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

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