Class: GPX::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/gpx_kml/gpx/track.rb

Overview

Docu

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(track) ⇒ Track

Returns a new instance of Track.



8
9
10
11
12
13
14
15
16
# File 'lib/gpx_kml/gpx/track.rb', line 8

def initialize(track)
  return unless track.is_a?(Nokogiri::XML::Element) && !track.xpath('self::xmlns:trk').empty?

  @name = track.xpath('./xmlns:name/text()').to_s
  @number = track.xpath('./xmlns:number/text()').to_s
  @description = track.xpath('./xmlns:desc/text()').to_s
  @link = track.xpath('./xmlns:link/@href').to_s
  @segments = _segments track
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



18
19
20
# File 'lib/gpx_kml/gpx/track.rb', line 18

def description
  @description
end

Returns the value of attribute link.



18
19
20
# File 'lib/gpx_kml/gpx/track.rb', line 18

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/gpx_kml/gpx/track.rb', line 18

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



18
19
20
# File 'lib/gpx_kml/gpx/track.rb', line 18

def number
  @number
end

#segmentsObject (readonly)

Returns the value of attribute segments.



18
19
20
# File 'lib/gpx_kml/gpx/track.rb', line 18

def segments
  @segments
end