dawarich/app/serializers/points/gpx_serializer.rb
2024-09-28 12:58:22 +02:00

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