Class: Stratify::Garmin::Presenter

Inherits:
Object
  • Object
show all
Defined in:
lib/stratify-garmin/presenter.rb

Instance Method Summary collapse

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

#detailsObject



14
15
16
# File 'lib/stratify-garmin/presenter.rb', line 14

def details
  join_fields_with_separator distance, time, description
end

#distanceObject



18
19
20
# File 'lib/stratify-garmin/presenter.rb', line 18

def distance
  "%0.2f miles" % @activity.distance_in_miles
end

#summaryObject



10
11
12
# File 'lib/stratify-garmin/presenter.rb', line 10

def summary
  "#{activity_type}: #{title}"
end

#timeObject



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