lib/traject_plus/extraction.rb in traject_plus-0.0.2 vs lib/traject_plus/extraction.rb in traject_plus-0.0.3
- old
+ new
@@ -33,10 +33,10 @@
# to_field 'x', gsub: ['a', 'b'] # 'abc' to 'bbc'
# to_field 'x', gsub: [/[abc]/, 'b'] # 'abc' to 'bbb'
# 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|
+ define_method(method) do |values, args|
values.flat_map do |v|
# Cannot prepend to frozen string; use #dup to effectively unfreeze
v.dup.public_send(method, *args)
end
end