Class: GitFit::Export::GPX

Inherits:
Object
  • Object
show all
Defined in:
lib/git_fit/export/gpx.rb

Constant Summary collapse

CATEGORY_MAP =
{
  'run' => 'running', 'ride' => 'cycling', 'walk' => 'walking',
  'hike' => 'hiking', 'swim' => 'swimming', 'ski' => 'skiing',
  'workout' => 'other', 'other' => 'other'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(db:, output:, activity_filter: nil) ⇒ GPX

Returns a new instance of GPX.



16
17
18
19
20
# File 'lib/git_fit/export/gpx.rb', line 16

def initialize(db:, output:, activity_filter: nil)
  @db = db
  @output = output
  @activity_filter = activity_filter
end

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
# File 'lib/git_fit/export/gpx.rb', line 22

def call
  FileUtils.mkdir_p(@output)
  activities = load_activities
  return 0 if activities.empty?

  activities.each { |a| write_gpx(a) }
  activities.size
end