Sha256: 248c0904371bfc296d12619df578144e3f4d224cbf40af24d262f7fbe3a9e723

Contents?: true

Size: 867 Bytes

Versions: 7

Compression:

Stored size: 867 Bytes

Contents

# 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
strava-ruby-client-2.2.0 lib/strava/models/mixins/elevation.rb
strava-ruby-client-2.1.0 lib/strava/models/mixins/elevation.rb
strava-ruby-client-2.0.0 lib/strava/models/mixins/elevation.rb
strava-ruby-client-1.1.0 lib/strava/models/mixins/elevation.rb
strava-ruby-client-1.0.1 lib/strava/models/mixins/elevation.rb
strava-ruby-client-1.0.0 lib/strava/models/mixins/elevation.rb
strava-ruby-client-0.4.3 lib/strava/models/mixins/elevation.rb