Class: Stratify::Garmin::Presenter
- Inherits:
-
Object
- Object
- Stratify::Garmin::Presenter
- Defined in:
- lib/stratify-garmin/presenter.rb
Instance Method Summary collapse
- #details ⇒ Object
- #distance ⇒ Object
-
#initialize(activity) ⇒ Presenter
constructor
A new instance of Presenter.
- #summary ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(activity) ⇒ Presenter
Returns a new instance of Presenter.
6 7 8 |
# File 'lib/stratify-garmin/presenter.rb', line 6 def initialize(activity) @activity = activity end |
Instance Method Details
#details ⇒ Object
14 15 16 |
# File 'lib/stratify-garmin/presenter.rb', line 14 def details join_fields_with_separator distance, time, description end |
#distance ⇒ Object
18 19 20 |
# File 'lib/stratify-garmin/presenter.rb', line 18 def distance "%0.2f miles" % @activity.distance_in_miles end |
#summary ⇒ Object
10 11 12 |
# File 'lib/stratify-garmin/presenter.rb', line 10 def summary "#{activity_type}: #{title}" end |
#time ⇒ Object
22 23 24 25 26 |
# File 'lib/stratify-garmin/presenter.rb', line 22 def time minutes = @activity.time_in_seconds / 60 seconds = @activity.time_in_seconds % 60 "#{minutes} minutes, #{seconds} seconds" end |