class NaturalEarth::Country

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/natural_earth/country.rb, line 7
def initialize(data)
  @data = data
end

Public Instance Methods

continent() click to toggle source
# File lib/natural_earth/country.rb, line 19
def continent
  data['continent']
end
geometry() click to toggle source
# File lib/natural_earth/country.rb, line 31
def geometry
  Geometries.country(iso3166)
end
iso3166(format: 'alpha-2') click to toggle source
# File lib/natural_earth/country.rb, line 11
def iso3166(format: 'alpha-2')
  data.dig('iso-3166-1', format)
end
name() click to toggle source
# File lib/natural_earth/country.rb, line 15
def name
  data['name']
end
region() click to toggle source
# File lib/natural_earth/country.rb, line 23
def region
  data['region']
end
subdivisions() click to toggle source
# File lib/natural_earth/country.rb, line 27
def subdivisions
  data['subdivisions'].each_with_object({}) { |iso3166, subs| subs[iso3166] = Subdivisions[iso3166] }
end