-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathelevation.rb
39 lines (30 loc) · 867 Bytes
/
elevation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true
module Strava
module Models
module Mixins
module Elevation
extend ActiveSupport::Concern
included do
property 'total_elevation_gain'
end
def total_elevation_gain_in_feet
total_elevation_gain * 3.28084
end
def total_elevation_gain_in_meters
total_elevation_gain
end
def total_elevation_gain_in_meters_s
return if total_elevation_gain.nil?
format('%gm', format('%.1f', total_elevation_gain_in_meters))
end
def total_elevation_gain_in_feet_s
return if total_elevation_gain.nil?
format('%gft', format('%.1f', total_elevation_gain_in_feet))
end
def total_elevation_gain_s
total_elevation_gain_in_meters_s
end
end
end
end
end