alexrabarts / iso_country_codes

A Ruby library that provides ISO 3166-1 country codes/names and ISO 4217 currencies
http://github.com/alexrabarts/iso-country-codes
163 stars 62 forks source link

Is there a way to add a country? #66

Open Mislavoo7 opened 2 years ago

Mislavoo7 commented 2 years ago

I had to add Kosovo and rename "Macedonia (the former Yugoslav Republic of)" to "North Macedonia". I fixed my issue by adding this:

class XXK < IsoCountryCodes::Code
  self.numeric = nil
  self.name    = %q{Kosovo}
  self.alpha2  = %q{XK}
  self.alpha3  = %q{XXK}
  self.iban    = 'XK'
  self.main_currency = 'EUR'
  self.continent = 'EU'
  self.calling = '+383'
end

IsoCountryCodes::Code::MKD.module_eval do
  self.name    = %q{North Macedonia}
end

Because I use the gem for Ruby on Rails I added the code to: config/initializers/adjust_iso_country_codes.rb. Kosovo appears on the last place. Where can I add .sort_by to resort all the countries?

sausyn commented 2 years ago

There is an open pull request with this data and a correction for South Sudan continent:

61