lib/traject_plus/extraction.rb in traject_plus-0.0.1 vs lib/traject_plus/extraction.rb in traject_plus-0.0.2
- old
+ new
@@ -35,10 +35,11 @@
# to_field 'x', encode: 'UTF-8' # 'abc' to 'abc'
# to_field 'x', insert: [1, 'x'] # 'abc' to 'axbc'
['split', 'concat', 'prepend', 'gsub', 'encode', 'insert'].each do |method|
define_method(method) do |values, *args|
values.flat_map do |v|
- v.public_send(method, *args)
+ # Cannot prepend to frozen string; use #dup to effectively unfreeze
+ v.dup.public_send(method, *args)
end
end
end
# to_field 'x', strip: true # ' abc ' to 'abc'