Module: NumbersAndWords::I18n::Pluralization

Defined in:
lib/numbers_and_words/i18n/pluralization.rb

Class Method Summary collapse

Class Method Details

.config_fileObject


24
25
26
# File 'lib/numbers_and_words/i18n/pluralization.rb', line 24

def config_file
  I18n.files('plurals', 'plurals.rb').first
end

.filesObject


20
21
22
# File 'lib/numbers_and_words/i18n/pluralization.rb', line 20

def files
  I18n.files 'plurals', '*.*'
end

.initObject


15
16
17
18
# File 'lib/numbers_and_words/i18n/pluralization.rb', line 15

def init
  ::I18n.load_path << config_file
  ::I18n::Backend::Simple.include ::I18n::Backend::Pluralization
end

.languagesObject


32
33
34
# File 'lib/numbers_and_words/i18n/pluralization.rb', line 32

def languages
  plurals_files.map { |path| path.split(%r{[/.]})[-2] }
end

.plurals_filesObject


28
29
30
# File 'lib/numbers_and_words/i18n/pluralization.rb', line 28

def plurals_files
  files - [config_file]
end