lib/stream_lines/reading/csv.rb in stream_lines-0.4.0 vs lib/stream_lines/reading/csv.rb in stream_lines-0.4.1
- old
+ new
@@ -21,10 +21,11 @@
include Enumerable
def initialize(url, **csv_options)
@url = url
@csv_options = accepted_csv_options(csv_options)
+ @first_row_headers = @csv_options[:headers] == true
encoding = @csv_options[:encoding] || Encoding.default_external
@stream = Stream.new(url, encoding: encoding)
end
@@ -39,10 +40,10 @@
private
attr_reader :url
def first_row_headers?
- @csv_options[:headers] == true
+ @first_row_headers
end
def assign_first_row_headers(first_line)
header_row = ::CSV.parse_line(first_line)
@csv_options[:headers] = header_row