Class: LibTAD::Places::Region
- Inherits:
-
Object
- Object
- LibTAD::Places::Region
- Defined in:
- lib/types/places/region.rb
Overview
The geographical region. Contains country, a textual description of the region and the name of the biggest place.
Instance Attribute Summary collapse
-
#biggestplace ⇒ String
readonly
Name of the biggest city within the region.
-
#country ⇒ Country
readonly
Country which the region belongs to.
-
#desc ⇒ String
readonly
Textual description of a region.
-
#locations ⇒ Array<LocationRef>
readonly
A list of all locations referenced by this region.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Region
constructor
A new instance of Region.
Constructor Details
#initialize(hash) ⇒ Region
Returns a new instance of Region.
26 27 28 29 30 31 32 |
# File 'lib/types/places/region.rb', line 26 def initialize(hash) @country = Country.new hash['country'] unless !hash.key?('country') @desc = hash.fetch('desc', nil) @biggestplace = hash.fetch('biggestplace', nil) @locations = hash.fetch('locations', nil) &.map { |e| LocationRef.new(e) } end |
Instance Attribute Details
#biggestplace ⇒ String (readonly)
Name of the biggest city within the region.
20 21 22 |
# File 'lib/types/places/region.rb', line 20 def biggestplace @biggestplace end |
#country ⇒ Country (readonly)
Country which the region belongs to.
8 9 10 |
# File 'lib/types/places/region.rb', line 8 def country @country end |
#desc ⇒ String (readonly)
Textual description of a region.
Example: All locations Example: most of Newfoundland and Labrador Example: some regions of Nunavut Territory; small region of Ontario
16 17 18 |
# File 'lib/types/places/region.rb', line 16 def desc @desc end |
#locations ⇒ Array<LocationRef> (readonly)
A list of all locations referenced by this region. Only returned if requested by specifying the parameter listplaces.
24 25 26 |
# File 'lib/types/places/region.rb', line 24 def locations @locations end |