runby_pace 0.2.74 → 0.2.75

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjNjNTQxNzczYzcyZmM5MWJiNDk4ZTFkMzAyZDVhNzVhOGYzOWVhMg==
4
+ ZjBmOWNkMTQ5ZTI3YWMyYTIzZDQzNjY5ZWVmMjY5NDdmOWUzZGRiYg==
5
5
  data.tar.gz: !binary |-
6
- YzVmOWZhZjJiZmRjODU3NjJmMmFhNTUxZTliNGNmNGJhNWJiMDE0Ng==
6
+ NDE3YWI0NTZhMWJjOGFkNDk3MjNiMjNjNGRjZTYzNWU0ODM4OTBlNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjI2ZjNmYWRjNzFiODI3YzAxZmE2YjAzODQwM2QxYTAzZmVkOTZkZDUyMjc2
10
- MmUxNjgwMzAwMTJhMDlhMzExZDUwZjZmNGI4YWFlOWE2MjdhNWYwNmExOTU5
11
- ODUzODQ1MTU2MTc1MjQyOGYxYTMyZmRkN2UxM2JhZDc4ODZhM2U=
9
+ MjZlMGU3ZmNjY2UxNGE4YTQzMTNkZDU1NTFjYTdlYTI4ZmE1NTYxMTJmM2Jm
10
+ ZTY3ZjFkOTQ1MTBiMzA3ZWRmNWFhMWI0YmZmYTg4ZjIwMTYzN2M1N2I4NGJl
11
+ OWEwM2VkNmI5NDkyOTI1ZDdjZDI4MmM0NjgxZDk0Yjk1NDJhOWI=
12
12
  data.tar.gz: !binary |-
13
- MmVkODlmOWRjZDA0ZWUxMmY5Mzg5ZjY5NzcyNzdkYjQxMzEzZjlkNjgwYWQy
14
- NjdjOGRlNTcwYmIyOGRjZDE0YzQyYWM0ODMwMjg0OTYwMWQ0OTkzOThlMzE3
15
- MjZkYjljY2ZjYjM0NTFmNDZjZDBkYmFkMzY4N2QyZGY0Zjg2MzQ=
13
+ YTE2MjgyZmNkZmMzZTA4Njg5N2E4MmIyMzAxYmI2ZDBlYjFkNTY3MjM0MzRi
14
+ ZTFiMzNlYmQzZWU3ZTZiYjk3YmFhNWNhNWYxN2M2YTM5Yjc5MGJiYWRhZTQy
15
+ ZWU5NWIyMDc1ZGE0ZDVlM2FlYjFmMDczNjQ1ZWExMmMxNWIxZTc=
data/lib/runby_pace.rb CHANGED
@@ -4,5 +4,5 @@ Dir[File.dirname(__FILE__) + '/runby_pace/*.rb'].each { |file| require file }
4
4
  Dir[File.dirname(__FILE__) + '/runby_pace/run_types/*.rb'].each { |file| require file }
5
5
 
6
6
  # The main module
7
- module RunbyPace
7
+ module Runby
8
8
  end
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Encapsulates the algorithms used to calculate target paces.
3
3
  class PaceData
4
4
  # The number of data points plotted on our line of 5K times.
@@ -26,8 +26,8 @@ module RunbyPace
26
26
  attr_reader :midpoint_radius_divisor
27
27
 
28
28
  def initialize(fastest_pace_km, slowest_pace_km, midpoint_radius_divisor)
29
- @fastest_pace_km = RunbyPace::PaceTime.new(fastest_pace_km)
30
- @slowest_pace_km = RunbyPace::PaceTime.new(slowest_pace_km)
29
+ @fastest_pace_km = Runby::PaceTime.new(fastest_pace_km)
30
+ @slowest_pace_km = Runby::PaceTime.new(slowest_pace_km)
31
31
  @midpoint_radius_divisor = midpoint_radius_divisor
32
32
  end
33
33
 
@@ -38,11 +38,11 @@ module RunbyPace
38
38
 
39
39
  # Calculate the prescribed pace for the given 5K time
40
40
  def calc(five_k_time, distance_units = :km)
41
- five_k_time = RunbyPace::PaceTime.new(five_k_time)
41
+ five_k_time = Runby::PaceTime.new(five_k_time)
42
42
  x2 = ((five_k_time.total_minutes * 2) - (MIDPOINT_X - 1)) - 1
43
43
  minutes_per_km = slope * x2 + @fastest_pace_km.total_minutes + curve_minutes(x2)
44
- minutes_per_unit = minutes_per_km * RunbyPace::PaceUnits.distance_conversion_factor(distance_units)
45
- RunbyPace::PaceTime.from_minutes(minutes_per_unit)
44
+ minutes_per_unit = minutes_per_km * Runby::PaceUnits.distance_conversion_factor(distance_units)
45
+ Runby::PaceTime.from_minutes(minutes_per_unit)
46
46
  end
47
47
 
48
48
  private
@@ -1,17 +1,17 @@
1
1
  require_relative 'runby_range'
2
2
 
3
- module RunbyPace
3
+ module Runby
4
4
  # Represents a range of paces, from fast to slow.
5
5
  class PaceRange < RunbyRange
6
6
  def initialize(fast, slow)
7
- @fast = RunbyPace::PaceTime.new(fast)
8
- @slow = RunbyPace::PaceTime.new(slow)
7
+ @fast = Runby::PaceTime.new(fast)
8
+ @slow = Runby::PaceTime.new(slow)
9
9
  end
10
10
 
11
11
  # Create a new pace range from an existing speed range.
12
12
  def self.from_speed_range(speed_range)
13
- fast = RunbyPace::RunMath.convert_speed_to_pace speed_range.fast
14
- slow = RunbyPace::RunMath.convert_speed_to_pace speed_range.slow
13
+ fast = Runby::RunMath.convert_speed_to_pace speed_range.fast
14
+ slow = Runby::RunMath.convert_speed_to_pace speed_range.slow
15
15
  PaceRange.new fast, slow
16
16
  end
17
17
  end
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Represents a human-readable time in the format MM:ss
3
3
  class PaceTime
4
4
  attr_reader :time_s, :minutes_part, :seconds_part
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Represents the distance units (e.g. kilometers, miles) used in paces
3
3
  # including the human-readable description of each unit
4
4
  # and the factor used to convert it to kilometers.
@@ -1,22 +1,22 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # An assortment of mathematical functions related to running.
3
3
  class RunMath
4
4
  def self.convert_pace_to_speed(pace)
5
- pace = RunbyPace::PaceTime.new(pace)
5
+ pace = Runby::PaceTime.new(pace)
6
6
  (60 / pace.total_minutes).round(2)
7
7
  end
8
8
 
9
9
  def self.convert_speed_to_pace(units_per_hour)
10
10
  raise 'units_per_hour must be numeric' unless units_per_hour.is_a? Numeric
11
- RunbyPace::PaceTime.from_minutes(60.0 / units_per_hour)
11
+ Runby::PaceTime.from_minutes(60.0 / units_per_hour)
12
12
  end
13
13
 
14
14
  def self.distance_traveled(pace, time)
15
15
  # TODO: I sense the need for a refactor...
16
16
  # Consider extracting a new Pace class, which consists of Time + Units
17
17
  # Then move this method to the new class, and give it a better name.
18
- pace = RunbyPace::PaceTime.new(pace)
19
- time = RunbyPace::PaceTime.new(time)
18
+ pace = Runby::PaceTime.new(pace)
19
+ time = Runby::PaceTime.new(time)
20
20
 
21
21
  divisor = pace.total_minutes / time.total_minutes
22
22
  distance_units_traveled = 1 / divisor
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Base class for all run types
3
3
  class RunType
4
4
  def description
@@ -15,7 +15,7 @@ module RunbyPace
15
15
  module RunTypes
16
16
  # Returns an initialized run type, given the name of an existing run type
17
17
  def self.new_from_name(run_type_name)
18
- Object.const_get("RunbyPace::RunTypes::#{run_type_name}").new
18
+ Object.const_get("Runby::RunTypes::#{run_type_name}").new
19
19
  end
20
20
  end
21
21
  end
@@ -1,6 +1,6 @@
1
1
  # This file is automatically generated by a rake task
2
2
 
3
- module RunbyPace
3
+ module Runby
4
4
  # Encapsulates data and behavior relating to all run types.
5
5
  module RunTypes
6
6
  def self.all
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  module RunTypes
3
3
  # Defines the venerable "distance run", the backbone of any distance running program.
4
4
  # Most of your runs should be at this pace. Harder than an "easy run" but still conversational.
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  module RunTypes
3
3
  # An easy run is basically a jog. It should be conversational.
4
4
  class EasyRun < RunType
@@ -1,6 +1,6 @@
1
1
  require_relative 'tempo_run'
2
2
 
3
- module RunbyPace
3
+ module Runby
4
4
  module RunTypes
5
5
  # The "fast tempo" pace roughly equates to your half-marathon pace.
6
6
  # It's a pace you could maintain for about an hour, if pressed.
@@ -1,10 +1,10 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Extend RunTypes with additional behavior. (See comments for details)
3
3
  module RunTypes
4
4
  # Currently, to find the radius of the curve in the pace table data for a given run time,
5
5
  # we start with a radius equal to that of the midpoint of the X axis for the data when
6
6
  # plotted on a graph. Then we use a radius divisor for the PaceData for each run type to
7
- # dial in the height of the curve. (See RunbyPace::PaceData)
7
+ # dial in the height of the curve. (See Runby::PaceData)
8
8
  # This method, #find_divisor, accepts a hash of "golden paces" for a run type along with
9
9
  # the number of seconds of allowable deviation from the golden pace. Then it proceeds
10
10
  # to brute force the divisor.
@@ -20,8 +20,8 @@ module RunbyPace
20
20
  viable_divisor = nil
21
21
 
22
22
  golden_paces.each do |five_k, golden_pace|
23
- five_k_time = RunbyPace::PaceTime.new(five_k.to_s)
24
- pace_data = RunbyPace::PaceData.new(first_pace, last_pace, candidate_divisor)
23
+ five_k_time = Runby::PaceTime.new(five_k.to_s)
24
+ pace_data = Runby::PaceData.new(first_pace, last_pace, candidate_divisor)
25
25
  calculated_pace = pace_data.calc(five_k_time)
26
26
  unless calculated_pace.almost_equals?(golden_pace, allowable_deviation)
27
27
  viable_divisor = nil
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  module RunTypes
3
3
  # Arguably one of the most important run types, the "long run" is harder than an "easy run", but easier than
4
4
  # a "distance run". It should remain conversational.
@@ -1,6 +1,6 @@
1
1
  require_relative 'tempo_run'
2
2
 
3
- module RunbyPace
3
+ module Runby
4
4
  module RunTypes
5
5
  # The "slow tempo" pace roughly equates to your marathon pace.
6
6
  class SlowTempoRun < TempoRun
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  module RunTypes
3
3
  # Combines the fast and slow tempo runs into one convenient range of paces
4
4
  class TempoRun < RunType
@@ -1,4 +1,4 @@
1
- module RunbyPace
1
+ module Runby
2
2
  # Base class for ranges of Runby data, e.g. PaceRange, SpeedRange, ...
3
3
  class RunbyRange
4
4
  attr_reader :fast, :slow
@@ -1,6 +1,6 @@
1
1
  require_relative 'runby_range'
2
2
 
3
- module RunbyPace
3
+ module Runby
4
4
  # Represents a range of speeds, from fast to slow.
5
5
  class SpeedRange < RunbyRange
6
6
  def initialize(fast, slow)
@@ -11,8 +11,8 @@ module RunbyPace
11
11
 
12
12
  # Create a new speed range from an existing pace range.
13
13
  def self.from_pace_range(pace_range)
14
- fast = RunbyPace::RunMath.convert_pace_to_speed pace_range.fast
15
- slow = RunbyPace::RunMath.convert_pace_to_speed pace_range.slow
14
+ fast = Runby::RunMath.convert_pace_to_speed pace_range.fast
15
+ slow = Runby::RunMath.convert_pace_to_speed pace_range.slow
16
16
  SpeedRange.new fast, slow
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
- module RunbyPace
1
+ module Runby
2
2
  VERSION = "0.2.#{`git rev-list --count HEAD`}".freeze
3
3
  end
data/runby_pace.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'runby_pace/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'runby_pace'
8
- spec.version = RunbyPace::VERSION
8
+ spec.version = Runby::VERSION
9
9
  spec.authors = ['Ty Walls']
10
10
  spec.email = ['tygerbytes@users.noreply.github.com']
11
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runby_pace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.74
4
+ version: 0.2.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Walls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,7 +97,7 @@ homepage: https://github.com/tygerbytes/runby-pace
97
97
  licenses:
98
98
  - MIT
99
99
  metadata:
100
- commit-hash: 2f95dbd6e8780b0f141fbad54968f291a2f087c9
100
+ commit-hash: 8cf22b765ba8397084356c114f0476c6e39e627a
101
101
  post_install_message:
102
102
  rdoc_options: []
103
103
  require_paths: