diff options
author | rm155 <86454369+rm155@users.noreply.github.com> | 2021-10-10 22:21:42 -0400 |
---|---|---|
committer | Sutou Kouhei <kou@cozmixng.org> | 2021-10-24 05:57:33 +0900 |
commit | ee948fc1b4cb1ad382beee709008bb93b8f6ba75 (patch) | |
tree | 323e979f3c67259699d838228d28a0ea4fb3ac92 /lib/csv | |
parent | 274882be62e5996d804e87103586feaeec381820 (diff) | |
download | ruby-ee948fc1b4cb1ad382beee709008bb93b8f6ba75.tar.gz |
[ruby/csv] Add support for Ractor (https://github.com/ruby/csv/pull/218)
https://github.com/ruby/csv/commit/a802690e11
Diffstat (limited to 'lib/csv')
-rw-r--r-- | lib/csv/csv.gemspec | 2 | ||||
-rw-r--r-- | lib/csv/parser.rb | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/csv/csv.gemspec b/lib/csv/csv.gemspec index 6948e9a72f..11c5b0f2a6 100644 --- a/lib/csv/csv.gemspec +++ b/lib/csv/csv.gemspec @@ -60,5 +60,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler" spec.add_development_dependency "rake" spec.add_development_dependency "benchmark_driver" - spec.add_development_dependency "test-unit", ">= 3.4.3" + spec.add_development_dependency "test-unit", ">= 3.4.8" end diff --git a/lib/csv/parser.rb b/lib/csv/parser.rb index 0d8a157fd7..3334acfbdd 100644 --- a/lib/csv/parser.rb +++ b/lib/csv/parser.rb @@ -480,9 +480,9 @@ class CSV begin StringScanner.new("x").scan("x") rescue TypeError - @@string_scanner_scan_accept_string = false + STRING_SCANNER_SCAN_ACCEPT_STRING = false else - @@string_scanner_scan_accept_string = true + STRING_SCANNER_SCAN_ACCEPT_STRING = true end def prepare_separators @@ -506,7 +506,7 @@ class CSV @first_column_separators = Regexp.new(@escaped_first_column_separator + "+".encode(@encoding)) else - if @@string_scanner_scan_accept_string + if STRING_SCANNER_SCAN_ACCEPT_STRING @column_end = @column_separator else @column_end = Regexp.new(@escaped_column_separator) @@ -725,6 +725,8 @@ class CSV end end + SCANNER_TEST_CHUNK_SIZE = + Integer((ENV["CSV_PARSER_SCANNER_TEST_CHUNK_SIZE"] || "1"), 10) def build_scanner inputs = @samples.collect do |sample| UnoptimizedStringIO.new(sample) @@ -734,10 +736,9 @@ class CSV else inputs << @input end - chunk_size = ENV["CSV_PARSER_SCANNER_TEST_CHUNK_SIZE"] || "1" InputsScanner.new(inputs, @encoding, - chunk_size: Integer(chunk_size, 10)) + chunk_size: SCANNER_TEST_CHUNK_SIZE) end else def build_scanner |