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