Class: NaturalEarth::Subdivision

Inherits:
Object
  • Object
show all
Defined in:
lib/natural_earth/subdivision.rb

Overview

A NaturalEarth subdivision

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Subdivision

Returns a new instance of Subdivision.



8
9
10
# File 'lib/natural_earth/subdivision.rb', line 8

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/natural_earth/subdivision.rb', line 6

def data
  @data
end

Instance Method Details

#countryObject



20
21
22
# File 'lib/natural_earth/subdivision.rb', line 20

def country
  Countries[data['country']]
end

#geometryObject



24
25
26
# File 'lib/natural_earth/subdivision.rb', line 24

def geometry
  Geometries.subdivision(iso3166)
end

#iso3166(_format: nil) ⇒ Object



12
13
14
# File 'lib/natural_earth/subdivision.rb', line 12

def iso3166(_format: nil)
  data['iso-3166-2']
end

#nameObject



16
17
18
# File 'lib/natural_earth/subdivision.rb', line 16

def name
  data['name']
end