Sha256: 9f0a94577e35d16d6c932e28c5142d29ed1b030004be84af42e671ab7612f669

Contents?: true

Size: 494 Bytes

Versions: 4

Compression:

Stored size: 494 Bytes

Contents

require 'nokogiri'
require 'geo_swap'
require_relative 'gpx_file'
require_relative 'kml_file'

module TF1Converter
  class Translation
    def self.from(file)
      new(file)
    end

    def initialize(gpx_file)
      parsed_gpx = Nokogiri::XML(gpx_file)
      parsed_gpx.remove_namespaces!
      @gpx = GpxFile.new(parsed_gpx)
    end

    def into(output_file)
      kml = KmlFile.new(@gpx.waypoints, @gpx.tracks).to_xml
      output_file.puts kml
      output_file.close
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tf1_converter-0.4.0 lib/tf1_converter/translation.rb
tf1_converter-0.3.2 lib/tf1_converter/translation.rb
tf1_converter-0.3.1 lib/tf1_converter/translation.rb
tf1_converter-0.3.0 lib/tf1_converter/translation.rb