Class: I18nCountries

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_countries.rb

Constant Summary collapse

VERSION =
"0.1.3"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeI18nCountries

Returns a new instance of I18nCountries.



9
10
11
12
13
14
15
16
17
18
# File 'lib/i18n_countries.rb', line 9

def initialize()
  @countries ||= {}
  @codes ||= {}
  localized_country_files.each_pair do |locale, file_path|
    @countries[locale] = Psych.load_file(file_path)
  end
  CSV.foreach(codes_file) do |row|
    @codes[row[0]] = { 'a3' => row[1], 'numeric' => row[2].to_i }
  end
end

Instance Attribute Details

#codesObject (readonly)

Returns the value of attribute codes.



7
8
9
# File 'lib/i18n_countries.rb', line 7

def codes
  @codes
end

#countriesObject (readonly)

Returns the value of attribute countries.



7
8
9
# File 'lib/i18n_countries.rb', line 7

def countries
  @countries
end

Instance Method Details

#localesObject



20
21
22
# File 'lib/i18n_countries.rb', line 20

def locales
  @countries.keys()
end