lib/rbbt/tsv/manipulate.rb in rbbt-util-5.5.50 vs lib/rbbt/tsv/manipulate.rb in rbbt-util-5.5.51
- old
+ new
@@ -247,15 +247,22 @@
else
case type
when :double
new_key_field_name, new_field_names = through new_key_field, new_fields, uniq, zipped do |key, value|
if data[key].nil?
- #data[key] = value.collect{|v| v.dup}
- data[key] = value.collect{|v| v.dup}
+ #data[key] = value.collect{|v| v.nil? ? nil : v.dup}
+ data[key] = value.dup
else
- current = data[key]
- value.each_with_index do |v, i|
- current[i].concat v
+ if current = data[key]
+ value.each_with_index do |v, i|
+ if _c = current[i]
+ _c.concat v if v
+ else
+ current[i] = v || []
+ end
+ end
+ else
+ current = v.collect{|e| [e] }
end
data[key] = current if data.respond_to? :tokyocabinet_class
end
end
when :flat