Class: Runby::RunbyRange

Inherits:
Object
  • Object
show all
Defined in:
lib/runby_pace/runby_range.rb

Overview

Base class for ranges of Runby data, e.g. PaceRange, SpeedRange, …

Direct Known Subclasses

PaceRange, SpeedRange

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunbyRange

Returns a new instance of RunbyRange.



8
9
10
11
12
# File 'lib/runby_pace/runby_range.rb', line 8

def initialize
  @fast = nil
  @slow = nil
  raise 'RunbyRange is a base class for PaceRange and SpeedRange. Instantiate one of them instead.'
end

Instance Attribute Details

#fastObject (readonly)

Returns the value of attribute fast.



6
7
8
# File 'lib/runby_pace/runby_range.rb', line 6

def fast
  @fast
end

#slowObject (readonly)

Returns the value of attribute slow.



6
7
8
# File 'lib/runby_pace/runby_range.rb', line 6

def slow
  @slow
end

Instance Method Details

#to_s(format: :short) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/runby_pace/runby_range.rb', line 14

def to_s(format: :short)
  if @fast == @slow
    @fast.to_s(format: format)
  else
    "#{@fast}-#{@slow}"
  end
end