rbbt-util 5.19.21 → 5.19.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/manipulate.rb +9 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3c8c7f2e41cd08eec87547934542bced14a9847
|
4
|
+
data.tar.gz: 0a0cb810cc8c2486f38d6359cca55396517092a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e92f327fb78dcffb29c37cb76601106f173d152b5861a9105eee78804b1a4ad85a5b7b6ab7c9d88e48bc1e000fb8692483645ba21d3edc96871103b80193dba
|
7
|
+
data.tar.gz: 929aefd28ebae95f9c9e71debc51ec57f8f3d2ff66631b820934a9f07498a290bfc0fec30ac9d983e8cd92aa533e3d7425b10c64b78b853afd70f96bf585c3ad
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -257,12 +257,16 @@ module TSV
|
|
257
257
|
with_unnamed do
|
258
258
|
if zipped or (type != :double and type != :flat)
|
259
259
|
new_key_field_name, new_field_names = through new_key_field, new_fields, uniq, zipped do |key, value|
|
260
|
-
if merge
|
261
|
-
|
262
|
-
|
263
|
-
|
260
|
+
if merge
|
261
|
+
if data[key]
|
262
|
+
new_values = data[key].dup
|
263
|
+
value.each_with_index do |v,i|
|
264
|
+
new_values[i] = [new_values[i], v].flatten
|
265
|
+
end
|
266
|
+
data[key] = new_values if Array === value
|
267
|
+
else
|
268
|
+
data[key] = value.collect{|v| [v]} if Array === value
|
264
269
|
end
|
265
|
-
data[key] = new_values if Array === value
|
266
270
|
else
|
267
271
|
data[key] = value.clone if Array === value
|
268
272
|
end
|