m26 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/m26.rb +4 -0
- data/lib/m26_constants.rb +2 -2
- data/lib/m26_ultra.rb +78 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23726f233388a0069c5caf3eaea3b6a04ebe4592
|
4
|
+
data.tar.gz: a92371efa9b9ccee824342b9f4826e765318be8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0a06b1b9d4562c2f584f35a92f4086cb556b5bfc5b5daa8241f4ad8941d208c597011ed777d802b3ee5f151e90f80655fd303b550507ab212e155fbce747528
|
7
|
+
data.tar.gz: 8d4c18c2372521a704d99c936371380cb3f0ddc33ae038bdc637782f5b9c8a4231cfab21c55dd39e9645ee1ac7dfe612f5be7b73463ad86b83bdc73def4d1953
|
data/lib/m26.rb
CHANGED
@@ -5,6 +5,7 @@ Copyright (C) 2013 Chris Joakim, JoakimSoftware LLC
|
|
5
5
|
=end
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
|
+
require 'date'
|
8
9
|
|
9
10
|
require 'm26_ruby_extensions'
|
10
11
|
require 'm26_age'
|
@@ -13,3 +14,6 @@ require 'm26_constants'
|
|
13
14
|
require 'm26_distance'
|
14
15
|
require 'm26_elapsed_time'
|
15
16
|
require 'm26_speed'
|
17
|
+
require 'm26_ultra'
|
18
|
+
|
19
|
+
# puts "m26 loaded in PID: #{Process.pid}"
|
data/lib/m26_constants.rb
CHANGED
data/lib/m26_ultra.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (C) 2013 Chris Joakim, JoakimSoftware LLC
|
4
|
+
|
5
|
+
=end
|
6
|
+
|
7
|
+
module M26
|
8
|
+
|
9
|
+
class Ultra
|
10
|
+
|
11
|
+
attr_accessor :run_pace, :run_time
|
12
|
+
attr_accessor :walk_pace, :walk_time
|
13
|
+
attr_accessor :stopped_time_per_hour, :stopped_time_pct, :moving_time_pct
|
14
|
+
attr_accessor :moving_secs, :moving_run_pct, :moving_walk_pct
|
15
|
+
attr_accessor :stop_factor, :moving_time, :total_time
|
16
|
+
attr_accessor :run_secs, :walk_secs, :avg_rw_secs
|
17
|
+
attr_accessor :moving_speed, :overall_speed
|
18
|
+
|
19
|
+
def initialize(rp, rt, wp, wt, sth=nil, debug=false)
|
20
|
+
@run_pace, @run_time = rp, rt
|
21
|
+
@walk_pace, @walk_time = wp, wt
|
22
|
+
@stopped_time_per_hour = sth
|
23
|
+
@overall_mph = 0.0
|
24
|
+
|
25
|
+
if stopped_time_per_hour
|
26
|
+
@stopped_time_pct = stopped_time_per_hour.secs.to_f / M26::Constants::SECONDS_PER_HOUR.to_f
|
27
|
+
@moving_time_pct = 1.0 - stopped_time_pct
|
28
|
+
else
|
29
|
+
@stopped_time_pct = 0.0
|
30
|
+
@moving_time_pct = 1.0
|
31
|
+
end
|
32
|
+
|
33
|
+
@moving_secs = (rt.secs + wt.secs).to_f
|
34
|
+
@moving_run_pct = rt.secs.to_f / moving_secs.to_f
|
35
|
+
@moving_walk_pct = 1.0 - moving_run_pct
|
36
|
+
|
37
|
+
@run_secs = moving_run_pct * rp.secs
|
38
|
+
@walk_secs = moving_walk_pct * wp.secs
|
39
|
+
@avg_rw_secs = (run_secs + walk_secs).to_f
|
40
|
+
|
41
|
+
@stop_factor = 1.0 - stopped_time_pct
|
42
|
+
@moving_time = M26::ElapsedTime.new(avg_rw_secs)
|
43
|
+
@total_time = M26::ElapsedTime.new(avg_rw_secs.to_f / stop_factor)
|
44
|
+
@moving_speed = M26::Speed.new(mile, moving_time)
|
45
|
+
@overall_speed = M26::Speed.new(mile, total_time)
|
46
|
+
|
47
|
+
if debug
|
48
|
+
puts "run_pace: #{run_pace.inspect}"
|
49
|
+
puts "run_time: #{run_time.inspect}"
|
50
|
+
puts "walk_pace: #{walk_pace.inspect}"
|
51
|
+
puts "walk_time: #{walk_time.inspect}"
|
52
|
+
puts "stopped_time_pct: #{stopped_time_pct.inspect}"
|
53
|
+
puts "moving_time_pct: #{moving_time_pct.inspect}"
|
54
|
+
puts "moving_secs: #{moving_secs.inspect}"
|
55
|
+
puts "moving_run_pct: #{moving_run_pct.inspect}"
|
56
|
+
puts "moving_walk_pct: #{moving_walk_pct.inspect}"
|
57
|
+
puts "run_secs: #{run_secs.inspect}"
|
58
|
+
puts "walk_secs: #{walk_secs.inspect}"
|
59
|
+
puts "avg_rw_secs: #{avg_rw_secs.inspect}"
|
60
|
+
puts "stop_factor: #{stop_factor}"
|
61
|
+
puts "moving_time: #{moving_time}"
|
62
|
+
puts "total_time: #{total_time}"
|
63
|
+
puts "moving_speed: #{moving_speed}"
|
64
|
+
puts "overall_speed: #{overall_speed}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def mile
|
69
|
+
M26::Distance.new(1.0)
|
70
|
+
end
|
71
|
+
|
72
|
+
def average_pace_per_mile
|
73
|
+
"#{@tpm.as_hhmmss}"
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m26
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Joakim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/m26_elapsed_time.rb
|
39
39
|
- lib/m26_ruby_extensions.rb
|
40
40
|
- lib/m26_speed.rb
|
41
|
+
- lib/m26_ultra.rb
|
41
42
|
homepage: https://github.com/cjoakim/m26
|
42
43
|
licenses:
|
43
44
|
- GPL-3
|