Sha256: 907a65fecdfb470d268cc8e8c1dfd608910e16ad702fa6af0252e3a252d22d69
Contents?: true
Size: 795 Bytes
Versions: 1
Compression:
Stored size: 795 Bytes
Contents
require_relative 'runby_range' module Runby # Represents a range of paces, from fast to slow. class PaceRange < RunbyRange def initialize(fast, slow, distance_units = :km) if fast.is_a?(Pace) && slow.is_a?(Pace) @fast = fast @slow = slow else # Hopefully 'fast' and 'slow' are parseable as a RunbyTime distance = Distance.new distance_units, 1 @fast = Pace.new(fast, distance) @slow = Pace.new(slow, distance) end end def as_speed_range SpeedRange.new @fast.as_speed, @slow.as_speed end def to_s(format: :long) if @fast == @slow @fast.to_s(format: format) else @fast.to_s(format: format).sub("#{@fast.time}", "#{@fast.time}-#{@slow.time}") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
runby_pace-0.6.109 | lib/runby_pace/pace_range.rb |