Class: PostRunner::PersonalRecords::Record
- Inherits:
-
Object
- 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 Attribute Summary collapse
-
#activity ⇒ Object
Returns the value of attribute activity.
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#sport ⇒ Object
Returns the value of attribute sport.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
-
#initialize(activity, sport, distance, duration, start_time) ⇒ Record
constructor
A new instance of Record.
- #to_table_row(t) ⇒ Object
Constructor Details
#initialize(activity, sport, distance, duration, start_time) ⇒ Record
Returns a new instance of Record.
89 90 91 92 93 94 95 |
# File 'lib/postrunner/PersonalRecords.rb', line 89 def initialize(activity, sport, distance, duration, start_time) @activity = activity @sport = sport @distance = distance @duration = duration @start_time = start_time end |
Instance Attribute Details
#activity ⇒ Object
Returns the value of attribute activity.
87 88 89 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def activity @activity end |
#distance ⇒ Object
Returns the value of attribute distance.
87 88 89 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def distance @distance end |
#duration ⇒ Object
Returns the value of attribute duration.
87 88 89 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def duration @duration end |
#sport ⇒ Object
Returns the value of attribute sport.
87 88 89 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def sport @sport end |
#start_time ⇒ Object
Returns the value of attribute start_time.
87 88 89 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def start_time @start_time end |
Instance Method Details
#to_table_row(t) ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/postrunner/PersonalRecords.rb', line 97 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) ]) + [ @activity.db.ref_by_fit_file(@activity.fit_file), ActivityLink.new(@activity, false), @start_time.strftime("%Y-%m-%d") ]) end |