class MyKML
Public Class Methods
new(logfile)
click to toggle source
# File lib/mykml.rb, line 11 def initialize(logfile) # parse the log file entries into a Dynarex file @dx = Dynarex.new 'log/entry(time, lat, lon)' @dx.format_mask = '\[[!time] #\d+\] *INFO -- : [!lat], [!lon]' a = File.read(logfile).lines a.shift if a.first =~ /^#/ @dx.import a.join end
Public Instance Methods
to_kml()
click to toggle source
# File lib/mykml.rb, line 25 def to_kml() doc = Nokogiri::XML(@dx.to_xml(pretty: true)) xslfile = File.read(File.join(File.dirname(__FILE__), '..', 'xsl','mykml.xsl')) xslt = Nokogiri::XSLT(xslfile) xslt.transform(doc) end