1
0

Optimize input parsing

- Use handrolled "parsing" instead of CSV
This commit is contained in:
Tim Kächele 2021-11-20 22:08:38 +01:00
parent 8d3c7d9bd4
commit 185de016ba

View File

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'csv'
module PlanetExpress module PlanetExpress
class ShipmentReader class ShipmentReader
include Enumerable include Enumerable
@ -13,7 +11,9 @@ module PlanetExpress
end end
def each def each
CSV.new(input, headers: false, col_sep: ' ').each do |row| input.each_line do |line|
row = line.split(" ")
date = parse_date(row) date = parse_date(row)
shipping_option = find_shipping_option(row) shipping_option = find_shipping_option(row)