Class: LibTAD::Places::Geo
- Inherits:
-
Object
- Object
- LibTAD::Places::Geo
- Defined in:
- lib/types/places/geo.rb
Overview
Geographical information about a location.
Instance Attribute Summary collapse
-
#country ⇒ Country
readonly
Country of the location.
-
#latitude ⇒ Float
readonly
Geographical latitude of the location.
-
#longitude ⇒ Float
readonly
Geographical longitude of the location.
-
#name ⇒ String
readonly
The name of the location.
-
#state ⇒ String
readonly
The state of the location within the country (only if applicable).
Instance Method Summary collapse
-
#initialize(hash) ⇒ Geo
constructor
A new instance of Geo.
Constructor Details
#initialize(hash) ⇒ Geo
Returns a new instance of Geo.
25 26 27 28 29 30 31 |
# File 'lib/types/places/geo.rb', line 25 def initialize(hash) @name = hash.fetch('name', nil) @state = hash.fetch('state', nil) @country = Country.new hash['country'] unless !hash.key?('country') @latitude = hash.fetch('latitude', nil) @longitude = hash.fetch('longitude', nil) end |
Instance Attribute Details
#country ⇒ Country (readonly)
Country of the location.
15 16 17 |
# File 'lib/types/places/geo.rb', line 15 def country @country end |
#latitude ⇒ Float (readonly)
Geographical latitude of the location.
19 20 21 |
# File 'lib/types/places/geo.rb', line 19 def latitude @latitude end |
#longitude ⇒ Float (readonly)
Geographical longitude of the location.
23 24 25 |
# File 'lib/types/places/geo.rb', line 23 def longitude @longitude end |
#name ⇒ String (readonly)
The name of the location.
7 8 9 |
# File 'lib/types/places/geo.rb', line 7 def name @name end |
#state ⇒ String (readonly)
The state of the location within the country (only if applicable).
11 12 13 |
# File 'lib/types/places/geo.rb', line 11 def state @state end |