rbbt-util 5.13.9 → 5.13.10
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 +4 -4
- data/lib/rbbt/tsv/util.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: 87c5c38e6ede7a788175865fe60f360ae7079e74
|
4
|
+
data.tar.gz: 1212c453f6eb077efd40fe1bf66ea6ea4980bf8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78648e8c39d5e047a796e04496fd4fca0256e0876c991487e704c7b091ae3e784df0307f16156d68960555b93ba79a244567b05eacc0625e9da493b52b44ecd2
|
7
|
+
data.tar.gz: 6753746430107682259a406ee627bf53dcf49a32333f97360bb3e47c745712ddc2f65744460707a8b4c3a0244184e4ca18322ea20414a068835352e85a488534
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -61,8 +61,8 @@ module TSV
|
|
61
61
|
@new_key_field = TSV.identify_field(key_field, fields, new_key_field)
|
62
62
|
|
63
63
|
raise "Key field #{ new_key_field } not found" if @new_key_field.nil?
|
64
|
-
@new_fields = case
|
65
|
-
when
|
64
|
+
@new_fields = case new_fields
|
65
|
+
when nil
|
66
66
|
case
|
67
67
|
when @new_key_field == :key
|
68
68
|
:all
|
@@ -74,11 +74,11 @@ module TSV
|
|
74
74
|
new.unshift :key
|
75
75
|
new
|
76
76
|
end
|
77
|
-
when Array
|
77
|
+
when Array
|
78
78
|
new_fields.collect do |field|
|
79
79
|
TSV.identify_field(key_field, fields, field)
|
80
80
|
end
|
81
|
-
when
|
81
|
+
when String, Symbol
|
82
82
|
[TSV.identify_field(key_field, fields, new_fields)]
|
83
83
|
else
|
84
84
|
raise "Unknown format for new_fields (should be nil, Array or String): #{new_fields.inspect}"
|
data/lib/rbbt/tsv/util.rb
CHANGED
@@ -129,7 +129,7 @@ module TSV
|
|
129
129
|
when String
|
130
130
|
return key if key_field == field
|
131
131
|
pos = fields.index field
|
132
|
-
pos
|
132
|
+
return pos if pos
|
133
133
|
return identify_field(key_field, fields, field.to_i) if field =~ /^\d+$/
|
134
134
|
raise "Field #{ field } was not found. Options: #{fields * ", "}" if pos.nil?
|
135
135
|
else
|