class GPX::Route

Docu

Attributes

description[R]
name[R]
number[R]
points[R]
time[R]

Public Class Methods

new(route) click to toggle source
# 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

Private Instance Methods

_points(route) click to toggle source
# File lib/gpx_kml/gpx/route.rb, line 22
def _points(route)
  route_points = []
  route.xpath('./xmlns:rtept').each_with_index do |rp, i|
    route_points[i] = Point.new(rp, self)
  end
  route_points
end