lib/nike_plus/activity.rb
## Activity pace in minutes per kilometer.
Activity pace in minutes per kilometer.
Activity pace in minutes per kilometer .
def mpk
      kmh = self.kmh
      return nil unless kmh and kmh.is_a?(Float)
      div = 60.0 / kmh
      min = div.floor
      sec = ( ( div - min ) * 60.0 ).round 
      "#{ sprintf("%.2d", min ) }:#{ sprintf("%.2d", sec ) }"
    end
def mpk kmh = self . kmh return nil unless kmh and kmh . is_a? ( Float ) div = 60.0 / kmh min = div . floor sec = ( ( div - min ) * 60.0 ) . round "#{ sprintf("%.2d", min ) }:#{ sprintf("%.2d", sec ) }" end
Activity pace in minutes per kilometer.
Activity pace in minutes per kilometer .