Class: Strava::Models::LatLng
- Inherits:
-
Object
- Object
- Strava::Models::LatLng
- Defined in:
- lib/strava/models/lat_lng.rb
Instance Attribute Summary collapse
-
#latlng ⇒ Object
Returns the value of attribute latlng.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(latlng = nil) ⇒ LatLng
constructor
A new instance of LatLng.
- #inspect ⇒ Object (also: #to_s)
- #lat ⇒ Object
- #lat=(value) ⇒ Object
- #lng ⇒ Object
- #lng=(value) ⇒ Object
- #to_a ⇒ Object (also: #to_h, #as_json)
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(latlng = nil) ⇒ LatLng
54 55 56 |
# File 'lib/strava/models/lat_lng.rb', line 54 def initialize(latlng = nil) @latlng = latlng end |
Instance Attribute Details
#latlng ⇒ Object
Returns the value of attribute latlng.
6 7 8 |
# File 'lib/strava/models/lat_lng.rb', line 6 def latlng @latlng end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/strava/models/lat_lng.rb', line 26 def ==(other) case other when LatLng @latlng == other.to_a when Array @latlng == other else false end end |
#inspect ⇒ Object Also known as: to_s
48 49 50 |
# File 'lib/strava/models/lat_lng.rb', line 48 def inspect @latlng.inspect end |
#lat ⇒ Object
8 9 10 |
# File 'lib/strava/models/lat_lng.rb', line 8 def lat @latlng[0] end |
#lat=(value) ⇒ Object
16 17 18 19 |
# File 'lib/strava/models/lat_lng.rb', line 16 def lat=(value) @latlng ||= [nil, nil] @latlng[0] = value end |
#lng ⇒ Object
12 13 14 |
# File 'lib/strava/models/lat_lng.rb', line 12 def lng @latlng[1] end |
#lng=(value) ⇒ Object
21 22 23 24 |
# File 'lib/strava/models/lat_lng.rb', line 21 def lng=(value) @latlng ||= [nil, nil] @latlng[1] = value end |
#to_a ⇒ Object Also known as: to_h, as_json
37 38 39 |
# File 'lib/strava/models/lat_lng.rb', line 37 def to_a @latlng end |
#to_json(*args) ⇒ Object
44 45 46 |
# File 'lib/strava/models/lat_lng.rb', line 44 def to_json(*args) as_json.to_json(args) end |