Class: NaturalEarth::Subdivision
- Inherits:
-
Object
- Object
- NaturalEarth::Subdivision
- Defined in:
- lib/natural_earth/subdivision.rb
Overview
A NaturalEarth subdivision
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #country ⇒ Object
- #geometry ⇒ Object
-
#initialize(data) ⇒ Subdivision
constructor
A new instance of Subdivision.
- #iso3166(_format: nil) ⇒ Object
- #name ⇒ Object
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
#data ⇒ Object (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
#country ⇒ Object
20 21 22 |
# File 'lib/natural_earth/subdivision.rb', line 20 def country Countries[data['country']] end |
#geometry ⇒ Object
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 |
#name ⇒ Object
16 17 18 |
# File 'lib/natural_earth/subdivision.rb', line 16 def name data['name'] end |