Class: PostRunner::PersonalRecords::Record
- Inherits:
-
PEROBS::Object
- Object
- PEROBS::Object
- PostRunner::PersonalRecords::Record
- Includes:
- Fit4Ruby::Converters
- Defined in:
- lib/postrunner/PersonalRecords.rb
Overview
The Record class stores a single speed or longest distance record. It also stores a reference to the Activity that contains the record.
Instance Method Summary collapse
-
#initialize(p, result) ⇒ Record
constructor
A new instance of Record.
- #to_table_row(t) ⇒ Object
Constructor Details
#initialize(p, result) ⇒ Record
Returns a new instance of Record.
99 100 101 102 103 104 105 106 107 |
# File 'lib/postrunner/PersonalRecords.rb', line 99 def initialize(p, result) super(p) self.activity = result.activity self.sport = result.sport self.distance = result.distance self.duration = result.duration self.start_time = result.start_time end |
Instance Method Details
#to_table_row(t) ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/postrunner/PersonalRecords.rb', line 109 def to_table_row(t) t.row((@duration.nil? ? [ 'Longest Distance', '%.3f km' % (@distance / 1000.0), '-' ] : [ PersonalRecords::SpeedRecordDistances[@sport][@distance], secsToHMS(@duration), speedToPace(@distance / @duration) ]) + [ @store['file_store'].ref_by_activity(@activity), ActivityLink.new(@activity, false), @start_time.strftime("%Y-%m-%d") ]) end |