lib/eco/csv/stream.rb in eco-helpers-3.0.19 vs lib/eco/csv/stream.rb in eco-helpers-3.0.20

- old
+ new

@@ -5,10 +5,11 @@ attr_reader :filename def initialize(filename, **kargs) raise ArgumentError, "File '#{filename}' does not exist" unless ::File.exist?(filename) + @filename = filename @params = { headers: true, skip_blanks: true }.merge(kargs) @@ -53,9 +54,10 @@ end # see https://dalibornasevic.com/posts/68-processing-large-csv-files-with-ruby def csv return @csv if instance_variable_defined?(:@csv) + @fd = ::File.open(filename, 'r') @csv = Eco::CSV.new(fd, **params) end def init