Class: Runby::Pace

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

Overview

Represents a pace consisting of a distance and a time in which that distance was covered

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, distance = '1K') ⇒ Pace

Returns a new instance of Pace.



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

def initialize(time, distance = '1K')
  @time = Runby::RunbyTime.parse(time)
  @distance = Runby::Distance.new(distance)
end

Instance Attribute Details

#distanceObject (readonly)

Returns the value of attribute distance.



4
5
6
# File 'lib/runby_pace/pace.rb', line 4

def distance
  @distance
end

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/runby_pace/pace.rb', line 4

def time
  @time
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/runby_pace/pace.rb', line 11

def to_s
  "#{time} per #{distance.pluralized_uom}"
end