Class: GpxTrackGenerator::GpxFile

Inherits:
Object
  • Object
show all
Defined in:
lib/gpx_track_generator/gpx_file.rb

Overview

A gpx file

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ GpxFile

Returns a new instance of GpxFile.



11
12
13
# File 'lib/gpx_track_generator/gpx_file.rb', line 11

def initialize(path)
  @path = path
end

Instance Method Details

#file_nameObject

Return file name



27
28
29
# File 'lib/gpx_track_generator/gpx_file.rb', line 27

def file_name
  File.basename(path)
end

#nodesObject

Return nodes



16
17
18
19
20
21
22
23
24
# File 'lib/gpx_track_generator/gpx_file.rb', line 16

def nodes
  document = Nokogiri::XML('')
  node_set = Nokogiri::XML::NodeSet.new(document)

  node_set += extract_route_nodes unless extract_route_nodes.empty?
  node_set += extract_track_nodes unless extract_track_nodes.empty?

  node_set
end