Class: PostRunner::ActivitySummary

Inherits:
Object
  • Object
show all
Includes:
Fit4Ruby::Converters, ViewWidgets
Defined in:
lib/postrunner/ActivitySummary.rb

Instance Method Summary collapse

Methods included from ViewWidgets

#button, #footer, #frame, #titlebar, #view_widgets_style

Constructor Details

#initialize(fit_activity, name, unit_system) ⇒ ActivitySummary

Returns a new instance of ActivitySummary.



25
26
27
28
29
# File 'lib/postrunner/ActivitySummary.rb', line 25

def initialize(fit_activity, name, unit_system)
  @fit_activity = fit_activity
  @name = name
  @unit_system = unit_system
end

Instance Method Details

#to_html(doc) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/postrunner/ActivitySummary.rb', line 37

def to_html(doc)
  session = @fit_activity.sessions[0]

  frame(doc, "Activity: #{@name}") {
    summary(session).to_html(doc)
  }
  frame(doc, 'Laps') {
    laps.to_html(doc)
  }
end

#to_sObject



31
32
33
34
35
# File 'lib/postrunner/ActivitySummary.rb', line 31

def to_s
  session = @fit_activity.sessions[0]

  summary(session).to_s + "\n" + laps.to_s
end