Module: NaturalEarth::Countries
- Extended by:
- ISO3166
- Defined in:
- lib/natural_earth/countries.rb
Overview
Give access to the list of supported countries
Class Method Summary collapse
-
.fetch(iso3166_1) ⇒ Object
(also: [])
Fetch information about a country, as a NaturalEarth::Country instance.
-
.supported ⇒ Object
(also: keys)
Return the list of supported countries as iso-3166-1 alpha-2 codes.
-
.supported?(iso3166_1) ⇒ Boolean
(also: key?)
Check if a country is supported.
Methods included from ISO3166
Class Method Details
.fetch(iso3166_1) ⇒ Object Also known as: []
Fetch information about a country, as a NaturalEarth::Country instance
21 22 23 24 25 |
# File 'lib/natural_earth/countries.rb', line 21 def fetch(iso3166_1) raise KeyError unless supported?(iso3166_1) NaturalEarth::Country.new(COUNTRIES[normalize(iso3166_1)]) end |
.supported ⇒ Object Also known as: keys
Return the list of supported countries as iso-3166-1 alpha-2 codes
11 12 13 |
# File 'lib/natural_earth/countries.rb', line 11 def supported COUNTRIES.keys end |
.supported?(iso3166_1) ⇒ Boolean Also known as: key?
Check if a country is supported
16 17 18 |
# File 'lib/natural_earth/countries.rb', line 16 def supported?(iso3166_1) COUNTRIES.key?(normalize(iso3166_1)) end |