Class: M26::Ultra
- Inherits:
-
Object
- Object
- M26::Ultra
- Defined in:
- lib/m26_ultra.rb
Instance Attribute Summary collapse
-
#avg_rw_secs ⇒ Object
Returns the value of attribute avg_rw_secs.
-
#moving_run_pct ⇒ Object
Returns the value of attribute moving_run_pct.
-
#moving_secs ⇒ Object
Returns the value of attribute moving_secs.
-
#moving_speed ⇒ Object
Returns the value of attribute moving_speed.
-
#moving_time ⇒ Object
Returns the value of attribute moving_time.
-
#moving_time_pct ⇒ Object
Returns the value of attribute moving_time_pct.
-
#moving_walk_pct ⇒ Object
Returns the value of attribute moving_walk_pct.
-
#overall_speed ⇒ Object
Returns the value of attribute overall_speed.
-
#run_pace ⇒ Object
Returns the value of attribute run_pace.
-
#run_secs ⇒ Object
Returns the value of attribute run_secs.
-
#run_time ⇒ Object
Returns the value of attribute run_time.
-
#stop_factor ⇒ Object
Returns the value of attribute stop_factor.
-
#stopped_time_pct ⇒ Object
Returns the value of attribute stopped_time_pct.
-
#stopped_time_per_hour ⇒ Object
Returns the value of attribute stopped_time_per_hour.
-
#total_time ⇒ Object
Returns the value of attribute total_time.
-
#walk_pace ⇒ Object
Returns the value of attribute walk_pace.
-
#walk_secs ⇒ Object
Returns the value of attribute walk_secs.
-
#walk_time ⇒ Object
Returns the value of attribute walk_time.
Instance Method Summary collapse
- #average_pace_per_mile ⇒ Object
-
#initialize(rp, rt, wp, wt, sth = nil, debug = false) ⇒ Ultra
constructor
A new instance of Ultra.
- #mile ⇒ Object
Constructor Details
#initialize(rp, rt, wp, wt, sth = nil, debug = false) ⇒ Ultra
Returns a new instance of Ultra.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/m26_ultra.rb', line 19 def initialize(rp, rt, wp, wt, sth=nil, debug=false) @run_pace, @run_time = rp, rt @walk_pace, @walk_time = wp, wt @stopped_time_per_hour = sth @overall_mph = 0.0 if stopped_time_per_hour @stopped_time_pct = stopped_time_per_hour.secs.to_f / M26::Constants::SECONDS_PER_HOUR.to_f @moving_time_pct = 1.0 - stopped_time_pct else @stopped_time_pct = 0.0 @moving_time_pct = 1.0 end @moving_secs = (rt.secs + wt.secs).to_f @moving_run_pct = rt.secs.to_f / moving_secs.to_f @moving_walk_pct = 1.0 - moving_run_pct @run_secs = moving_run_pct * rp.secs @walk_secs = moving_walk_pct * wp.secs @avg_rw_secs = (run_secs + walk_secs).to_f @stop_factor = 1.0 - stopped_time_pct @moving_time = M26::ElapsedTime.new(avg_rw_secs) @total_time = M26::ElapsedTime.new(avg_rw_secs.to_f / stop_factor) @moving_speed = M26::Speed.new(mile, moving_time) @overall_speed = M26::Speed.new(mile, total_time) if debug puts "run_pace: #{run_pace.inspect}" puts "run_time: #{run_time.inspect}" puts "walk_pace: #{walk_pace.inspect}" puts "walk_time: #{walk_time.inspect}" puts "stopped_time_pct: #{stopped_time_pct.inspect}" puts "moving_time_pct: #{moving_time_pct.inspect}" puts "moving_secs: #{moving_secs.inspect}" puts "moving_run_pct: #{moving_run_pct.inspect}" puts "moving_walk_pct: #{moving_walk_pct.inspect}" puts "run_secs: #{run_secs.inspect}" puts "walk_secs: #{walk_secs.inspect}" puts "avg_rw_secs: #{avg_rw_secs.inspect}" puts "stop_factor: #{stop_factor}" puts "moving_time: #{moving_time}" puts "total_time: #{total_time}" puts "moving_speed: #{moving_speed}" puts "overall_speed: #{overall_speed}" end end |
Instance Attribute Details
#avg_rw_secs ⇒ Object
Returns the value of attribute avg_rw_secs.
16 17 18 |
# File 'lib/m26_ultra.rb', line 16 def avg_rw_secs @avg_rw_secs end |
#moving_run_pct ⇒ Object
Returns the value of attribute moving_run_pct.
14 15 16 |
# File 'lib/m26_ultra.rb', line 14 def moving_run_pct @moving_run_pct end |
#moving_secs ⇒ Object
Returns the value of attribute moving_secs.
14 15 16 |
# File 'lib/m26_ultra.rb', line 14 def moving_secs @moving_secs end |
#moving_speed ⇒ Object
Returns the value of attribute moving_speed.
17 18 19 |
# File 'lib/m26_ultra.rb', line 17 def moving_speed @moving_speed end |
#moving_time ⇒ Object
Returns the value of attribute moving_time.
15 16 17 |
# File 'lib/m26_ultra.rb', line 15 def moving_time @moving_time end |
#moving_time_pct ⇒ Object
Returns the value of attribute moving_time_pct.
13 14 15 |
# File 'lib/m26_ultra.rb', line 13 def moving_time_pct @moving_time_pct end |
#moving_walk_pct ⇒ Object
Returns the value of attribute moving_walk_pct.
14 15 16 |
# File 'lib/m26_ultra.rb', line 14 def moving_walk_pct @moving_walk_pct end |
#overall_speed ⇒ Object
Returns the value of attribute overall_speed.
17 18 19 |
# File 'lib/m26_ultra.rb', line 17 def overall_speed @overall_speed end |
#run_pace ⇒ Object
Returns the value of attribute run_pace.
11 12 13 |
# File 'lib/m26_ultra.rb', line 11 def run_pace @run_pace end |
#run_secs ⇒ Object
Returns the value of attribute run_secs.
16 17 18 |
# File 'lib/m26_ultra.rb', line 16 def run_secs @run_secs end |
#run_time ⇒ Object
Returns the value of attribute run_time.
11 12 13 |
# File 'lib/m26_ultra.rb', line 11 def run_time @run_time end |
#stop_factor ⇒ Object
Returns the value of attribute stop_factor.
15 16 17 |
# File 'lib/m26_ultra.rb', line 15 def stop_factor @stop_factor end |
#stopped_time_pct ⇒ Object
Returns the value of attribute stopped_time_pct.
13 14 15 |
# File 'lib/m26_ultra.rb', line 13 def stopped_time_pct @stopped_time_pct end |
#stopped_time_per_hour ⇒ Object
Returns the value of attribute stopped_time_per_hour.
13 14 15 |
# File 'lib/m26_ultra.rb', line 13 def stopped_time_per_hour @stopped_time_per_hour end |
#total_time ⇒ Object
Returns the value of attribute total_time.
15 16 17 |
# File 'lib/m26_ultra.rb', line 15 def total_time @total_time end |
#walk_pace ⇒ Object
Returns the value of attribute walk_pace.
12 13 14 |
# File 'lib/m26_ultra.rb', line 12 def walk_pace @walk_pace end |
#walk_secs ⇒ Object
Returns the value of attribute walk_secs.
16 17 18 |
# File 'lib/m26_ultra.rb', line 16 def walk_secs @walk_secs end |
#walk_time ⇒ Object
Returns the value of attribute walk_time.
12 13 14 |
# File 'lib/m26_ultra.rb', line 12 def walk_time @walk_time end |