Class: ExtraSpace::Geocode
- Inherits:
-
Object
- Object
- ExtraSpace::Geocode
- Defined in:
- lib/extraspace/geocode.rb
Overview
The geocode (latitude + longitude) of a facility.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(latitude:, longitude:) ⇒ Geocode
constructor
A new instance of Geocode.
- #inspect ⇒ String
- #text ⇒ String
Constructor Details
#initialize(latitude:, longitude:) ⇒ Geocode
Returns a new instance of Geocode.
26 27 28 29 |
# File 'lib/extraspace/geocode.rb', line 26 def initialize(latitude:, longitude:) @latitude = latitude @longitude = longitude end |
Instance Attribute Details
#latitude ⇒ Float
8 9 10 |
# File 'lib/extraspace/geocode.rb', line 8 def latitude @latitude end |
#longitude ⇒ Float
12 13 14 |
# File 'lib/extraspace/geocode.rb', line 12 def longitude @longitude end |
Class Method Details
.parse(data:) ⇒ Geocode
17 18 19 20 21 22 |
# File 'lib/extraspace/geocode.rb', line 17 def self.parse(data:) new( latitude: data['latitude'], longitude: data['longitude'] ) end |
Instance Method Details
#inspect ⇒ String
32 33 34 35 36 37 38 |
# File 'lib/extraspace/geocode.rb', line 32 def inspect props = [ "latitude=#{@latitude.inspect}", "longitude=#{@longitude.inspect}" ] "#<#{self.class.name} #{props.join(' ')}>" end |
#text ⇒ String
41 42 43 |
# File 'lib/extraspace/geocode.rb', line 41 def text "#{@latitude},#{@longitude}" end |