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

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

Class Method Summary collapse

Class Method Details

.allObject


13
14
15
# File 'lib/twitter_cldr/formatters/plurals/rules.rb', line 13

def all
  all_for(TwitterCldr.get_locale)
end

.all_for(locale) ⇒ Object


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

def all_for(locale)
  locale = TwitterCldr.convert_locale(locale.to_sym)
  get_resource(locale)[locale][:i18n][:plural][:keys]
rescue
  nil
end

.rule_for(number, locale = TwitterCldr.get_locale) ⇒ Object


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

def rule_for(number, locale = TwitterCldr.get_locale)
  locale = TwitterCldr.convert_locale(locale.to_sym)
  get_resource(locale)[locale][:i18n][:plural][:rule].call(number)
rescue
  :other
end