Class: PostRunner::PersonalRecords::Record
- Inherits:
-
Object
- Object
- PostRunner::PersonalRecords::Record
- Includes:
- Fit4Ruby::Converters
- Defined in:
- lib/postrunner/PersonalRecords.rb
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.
79 80 81 82 83 84 85 |
# File 'lib/postrunner/PersonalRecords.rb', line 79 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.
77 78 79 |
# File 'lib/postrunner/PersonalRecords.rb', line 77 def activity @activity end |
#distance ⇒ Object
Returns the value of attribute distance.
77 78 79 |
# File 'lib/postrunner/PersonalRecords.rb', line 77 def distance @distance end |
#duration ⇒ Object
Returns the value of attribute duration.
77 78 79 |
# File 'lib/postrunner/PersonalRecords.rb', line 77 def duration @duration end |
#sport ⇒ Object
Returns the value of attribute sport.
77 78 79 |
# File 'lib/postrunner/PersonalRecords.rb', line 77 def sport @sport end |
#start_time ⇒ Object
Returns the value of attribute start_time.
77 78 79 |
# File 'lib/postrunner/PersonalRecords.rb', line 77 def start_time @start_time end |
Instance Method Details
#to_table_row(t) ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/postrunner/PersonalRecords.rb', line 87 def to_table_row(t) t.row((@duration.nil? ? [ 'Longest Run', '%.1f m' % @distance, '-' ] : [ 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 |