Class: GPX::Route

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

Overview

Docu

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ Route

Returns a new instance of Route.



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

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

  @name = route.xpath('./xmlns:name/text()').to_s
  @number = route.xpath('./xmlns:number/text()').to_s
  @description = route.xpath('./xmlns:desc/text()').to_s
  @link = route.xpath('./xmlns:link/@href').to_s
  @points = _points route
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

Returns the value of attribute link.



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

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



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

def number
  @number
end

#pointsObject (readonly)

Returns the value of attribute points.



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

def points
  @points
end

#timeObject (readonly)

Returns the value of attribute time.



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

def time
  @time
end