dawarich/app/services/own_tracks/rec_parser.rb

21 lines
340 B
Ruby
Raw Normal View History

2024-10-15 16:30:16 -04:00
# frozen_string_literal: true
class OwnTracks::RecParser
attr_reader :file
def initialize(file)
@file = file
2024-10-15 16:30:16 -04:00
end
def call
file.split("\n").map do |line|
parts = line.split("\t")
if parts.size > 2 && parts[1].strip == '*'
JSON.parse(parts[2])
else
nil
end
end.compact
2024-10-15 16:30:16 -04:00
end
end