Module: TwitterCldr::Formatters::Plurals::Rules

Defined in:
lib/twitter_cldr/formatters/plurals/rules.rb

Constant Summary collapse

DEFAULT_TYPE =
:cardinal

Class Method Summary collapse

Class Method Details

.all(type = DEFAULT_TYPE) ⇒ Object



17
18
19
# File 'lib/twitter_cldr/formatters/plurals/rules.rb', line 17

def all(type = DEFAULT_TYPE)
  all_for(TwitterCldr.locale, type)
end

.all_for(locale, type = DEFAULT_TYPE) ⇒ Object



21
22
23
# File 'lib/twitter_cldr/formatters/plurals/rules.rb', line 21

def all_for(locale, type = DEFAULT_TYPE)
  names(locale, type)
end

.rule_for(number, locale = TwitterCldr.locale, type = DEFAULT_TYPE) ⇒ Object



25
26
27
28
29
# File 'lib/twitter_cldr/formatters/plurals/rules.rb', line 25

def rule_for(number, locale = TwitterCldr.locale, type = DEFAULT_TYPE)
  rule(locale, type).call(number.to_s, CldrPlurals::RubyRuntime)
rescue
  :other
end