Method: ISO3166::Data.register

Defined in:
lib/countries/data.rb

.register(data) ⇒ Object

Registers a new Country with custom data. If you are overriding an existing country, this does not perform a deep merge so you will need to __bring in all data you wish to be available__. Overriding an existing country will also remove it from the internal management of translations.



28
29
30
31
32
33
# File 'lib/countries/data.rb', line 28

def register(data)
  alpha2 = data[:alpha2].upcase
  @registered_data[alpha2] = deep_stringify_keys(data)
  @registered_data[alpha2]['translations'] = Translations.new.merge(data['translations'] || {})
  @cache = cache.merge(@registered_data)
end