class OVOV::Calculator::Run
Constants
- IMPOSSIBLE_PERFORMANCE
- POOR_PERFORMANCE
- TIME_REGEX
Public Instance Methods
calculate()
click to toggle source
# File lib/calculator/disciplines/run.rb, line 12 def calculate return 0 if @performance >= POOR_PERFORMANCE || @performance < IMPOSSIBLE_PERFORMANCE @points = ((442.5 - @performance) / 2.5) * 10 end
performance=(value)
click to toggle source
Calls superclass method
# File lib/calculator/disciplines/run.rb, line 8 def performance=(value) super(convert_time_to_seconds(value)) end
Private Instance Methods
convert_time_to_seconds(performance)
click to toggle source
# File lib/calculator/disciplines/run.rb, line 20 def convert_time_to_seconds(performance) return performance unless performance =~ TIME_REGEX 60 * performance.split(':').first.to_i + performance.split(':').last.to_i end