mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
26 lines
424 B
Ruby
26 lines
424 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Points::GpxSerializer
|
|
def initialize(points)
|
|
@points = points
|
|
end
|
|
|
|
def call
|
|
gpx = GPX::GPXFile.new
|
|
|
|
points.each do |point|
|
|
gpx.waypoints << GPX::Waypoint.new(
|
|
lat: point.latitude.to_f,
|
|
lon: point.longitude.to_f,
|
|
time: point.recorded_at,
|
|
ele: point.altitude.to_f
|
|
)
|
|
end
|
|
|
|
gpx
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :points
|
|
end
|