Class: GitFit::Parser::GPX

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

Constant Summary collapse

NS =
{ gpx: "http://www.topografix.com/GPX/1/1" }.freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GitFit::Parser::Base

Instance Method Details

#call(input) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/git_fit/parser/gpx.rb', line 9

def call(input)
  doc = input.is_a?(String) ? Nokogiri::XML(input) : input
  doc.remove_namespaces!
  tracks = doc.xpath("//trk")
  return [] if tracks.empty?
  tracks.filter_map { |trk| parse_track(trk) }
end