Class: I18nCountries
- Inherits:
-
Object
- Object
- I18nCountries
- Defined in:
- lib/i18n_countries.rb
Constant Summary collapse
- VERSION =
"0.1.3"
Instance Attribute Summary collapse
-
#codes ⇒ Object
readonly
Returns the value of attribute codes.
-
#countries ⇒ Object
readonly
Returns the value of attribute countries.
Instance Method Summary collapse
-
#initialize ⇒ I18nCountries
constructor
A new instance of I18nCountries.
- #locales ⇒ Object
Constructor Details
#initialize ⇒ I18nCountries
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
#codes ⇒ Object (readonly)
Returns the value of attribute codes.
7 8 9 |
# File 'lib/i18n_countries.rb', line 7 def codes @codes end |
#countries ⇒ Object (readonly)
Returns the value of attribute countries.
7 8 9 |
# File 'lib/i18n_countries.rb', line 7 def countries @countries end |
Instance Method Details
#locales ⇒ Object
20 21 22 |
# File 'lib/i18n_countries.rb', line 20 def locales @countries.keys() end |