rbbt-util 5.19.20 → 5.19.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/manipulate.rb +10 -2
- data/lib/rbbt/util/cmd.rb +1 -1
- 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: ca3e2230936d064486604218af99737d45910c46
|
4
|
+
data.tar.gz: 99ad2aabb12f79e52ecd2eb1a94caa56ab0f0a8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d04573a2275622180dabe063a3f3b13e7bd82c2e6fc4da9b3099170199136e292b7cb94490722e063895d6e019bd054513abfb1ddfda4f98df4b5b94f5bf8f8e
|
7
|
+
data.tar.gz: 4a66cb6cd9336bdd807371228061d3ccfa4df6c7069cd45dd08a5b0ba716d6978b74230c6568dde0a848c7d6a4a134a5463a238c8791ba6c087ad96797b700a6
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -242,7 +242,7 @@ module TSV
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def reorder(new_key_field = nil, new_fields = nil, options = {})
|
245
|
-
zipped, uniq = Misc.process_options options, :zipped, :uniq
|
245
|
+
zipped, uniq, merge = Misc.process_options options, :zipped, :uniq, :merge
|
246
246
|
|
247
247
|
persist_options = Misc.pull_keys options, :persist
|
248
248
|
persist_options[:prefix] = "Reorder"
|
@@ -257,7 +257,15 @@ 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
|
-
data[key]
|
260
|
+
if merge and data[key]
|
261
|
+
new_values = data[key].dup
|
262
|
+
value.each_with_index do |v,i|
|
263
|
+
new_values[i] = [new_values[i], v].flatten
|
264
|
+
end
|
265
|
+
data[key] = new_values if Array === value
|
266
|
+
else
|
267
|
+
data[key] = value.clone if Array === value
|
268
|
+
end
|
261
269
|
end
|
262
270
|
else
|
263
271
|
case type
|
data/lib/rbbt/util/cmd.rb
CHANGED
@@ -219,7 +219,7 @@ module CMD
|
|
219
219
|
|
220
220
|
Process.waitpid pid
|
221
221
|
|
222
|
-
if not $?.success?
|
222
|
+
if not $?.success? and not no_fail
|
223
223
|
raise ProcessFailed.new "Command [#{pid}] #{cmd} failed with error status #{$?.exitstatus}.\n#{err}"
|
224
224
|
else
|
225
225
|
Log.log err, stderr if Integer === stderr and log
|