From af5ed54acc2736d760558731944eeaeb43835bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Krej=C4=8D=C3=AD?= Date: Mon, 2 Nov 2020 11:22:11 +0100 Subject: [PATCH] Fix separator detection not working for one column csv files --- lib/acsv/csv.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/acsv/csv.rb b/lib/acsv/csv.rb index a606af9..abdf316 100644 --- a/lib/acsv/csv.rb +++ b/lib/acsv/csv.rb @@ -14,7 +14,10 @@ class CSV < ::CSV # # @see http://www.ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html#method-c-new def initialize(data, options = Hash.new) - options[:col_sep] ||= ACSV::Detect.separator(data) + if !options.key?(:col_sep) && (separator = ACSV::Detect.separator(data)) + options[:col_sep] = separator + end + super(data, options) end