lib/smarter_csv.rb in smarter_csv-1.8.2 vs lib/smarter_csv.rb in smarter_csv-1.8.3
- old
+ new
@@ -1,12 +1,15 @@
# frozen_string_literal: true
require_relative "extensions/hash"
require_relative "smarter_csv/version"
-require_relative "smarter_csv/smarter_csv" unless ENV['CI'] # does not compile/link in CI?
-# require 'smarter_csv.bundle' unless ENV['CI'] # local testing
+if `uname -s`.chomp == 'Darwin'
+ require 'smarter_csv.bundle' unless ENV['CI'] # local testing
+else
+ require_relative "smarter_csv/smarter_csv" unless ENV['CI'] # does not compile/link in CI?
+end
module SmarterCSV
class SmarterCSVException < StandardError; end
class HeaderSizeMismatch < SmarterCSVException; end
class IncorrectOption < SmarterCSVException; end
@@ -409,10 +412,10 @@
end
rewind(filehandle)
if candidates.values.max == 0
# if the header only contains
- return ',' if line =~ /^\w+$/
+ return ',' if line.chomp(options[:row_sep]) =~ /^\w+$/
raise SmarterCSV::NoColSepDetected
end
candidates.key(candidates.values.max)