diff options
author | Sutou Kouhei <[email protected]> | 2021-09-15 15:58:57 +0900 |
---|---|---|
committer | Sutou Kouhei <[email protected]> | 2021-10-24 05:57:33 +0900 |
commit | 39ecdabe67d1bc7c864ada6f282590dbc9d3a14e () | |
tree | 4b01e5388ee0667feaccc3547e1e10acb5b808d9 /lib/csv | |
parent | 8aaa1c279f7c05a22dd108888d425565fc43e26f (diff) |
[ruby/csv] Resolve CSV::Converters and HeaderConverters lazy
It's for Ractor. If you want to use the built-in converters, you should call Ractor.make_shareable(CSV::Converters) and/or Ractor.make_shareable(CSV::HeaderConverters). https://.com/ruby/csv/commit/b0b1325d6b
Notes: Merged: https://.com/ruby/ruby/pull/5010
-rw-r--r-- | lib/csv/fields_converter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -16,7 +16,7 @@ class CSV @empty_value = options[:empty_value] @empty_value_is_empty_string = (@empty_value == "") @accept_nil = options[:accept_nil] - @builtin_converters = options[:builtin_converters] @need_static_convert = need_static_convert? end @@ -24,7 +24,7 @@ class CSV if name.nil? # custom converter @converters << converter else # named converter - combo = @builtin_converters[name] case combo when Array # combo converter combo.each do |sub_name| @@ -80,5 +80,9 @@ class CSV @need_static_convert or (not @converters.empty?) end end end |