Class: Strava::Models::LatLng

Inherits:
Object
  • Object
show all
Defined in:
lib/strava/models/lat_lng.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#latlngObject

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

#inspectObject Also known as: to_s



48
49
50
# File 'lib/strava/models/lat_lng.rb', line 48

def inspect
  @latlng.inspect
end

#latObject



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

#lngObject



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_aObject 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