Class: LibTAD::Places::Region

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#biggestplaceString (readonly)

Name of the biggest city within the region.

Returns:

  • (String)


20
21
22
# File 'lib/types/places/region.rb', line 20

def biggestplace
  @biggestplace
end

#countryCountry (readonly)

Country which the region belongs to.

Returns:



8
9
10
# File 'lib/types/places/region.rb', line 8

def country
  @country
end

#descString (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

Returns:

  • (String)


16
17
18
# File 'lib/types/places/region.rb', line 16

def desc
  @desc
end

#locationsArray<LocationRef> (readonly)

A list of all locations referenced by this region. Only returned if requested by specifying the parameter listplaces.

Returns:



24
25
26
# File 'lib/types/places/region.rb', line 24

def locations
  @locations
end