rbbt-util 5.34.14 → 5.34.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2e50428f936aab209874c5f26e7504aa14da9a30bc7e2b13575432527a5b6a4
4
- data.tar.gz: e522b76bb910b477e303e2cfc323c8708fa4d3bbecc0a7c46de473fe81f1ef6a
3
+ metadata.gz: 7eff409b235c1e08141d4c3c4f30600e91d3c033598731ff6457f1e826389597
4
+ data.tar.gz: 279844e3cda015f07db9429faf3e9941f12080be28b21bafa2f8472d784969b8
5
5
  SHA512:
6
- metadata.gz: e73a4ceda5eca11497ea4f0fe91fda7275375aaf8aeb6f9f70a45a46d4c71022527d7cd32c0cb30700a6bc2724bd1e2d2e0bd808a553ee3c8d6e729baa1dc2c0
7
- data.tar.gz: a050c5defff3e3d36fe5682c117802d54cfeb930e3e61ff96da29e326719bf97af6fe85b5c30812dd91c5c6a447201164c15a3e1714aa1226690a0c49782ba9a
6
+ metadata.gz: 1047b4a4449dd169bb572790f7dec2ac15f3ee99a6ed45a81108a102f00870d16f0c07776addd9746bf7656d86285e472234f880308ce8ca8c1d5c8fb3df2ad7
7
+ data.tar.gz: 227c22590c7d08d4e47121c1f814af71d11b9afa7f5fd71aabed014a8e857b6ebd7424b70ed669b8bc3aa993461339209ca1a67a15c3ab9cf81ac9fd85a83cbe
@@ -146,9 +146,22 @@ module Persist
146
146
  data.serializer = :type
147
147
  end
148
148
 
149
- data.write_and_read do
150
- yield data
149
+ if persist_options[:persist] == :preload
150
+ tmp_tsv = yield({})
151
+ tmp_tsv.annotate data
152
+ data.serializer = tmp_tsv.type
153
+ data.write_and_read do
154
+ tmp_tsv.each do |k,v|
155
+ data[k] = v
156
+ end
157
+ end
158
+ else
159
+ data.write_and_read do
160
+ yield data
161
+ end
162
+ end
151
163
 
164
+ data.write_and_read do
152
165
  FileUtils.mv data.persistence_path, path if File.exist? data.persistence_path and not File.exist? path
153
166
  tsv = CONNECTIONS[path] = CONNECTIONS.delete tmp_path
154
167
  tsv.persistence_path = path
@@ -165,6 +178,7 @@ module Persist
165
178
  end
166
179
  end
167
180
  end
181
+
168
182
  end
169
183
 
170
184
  require 'rbbt/persist/tsv/sharder'
@@ -360,7 +360,7 @@ module TSV
360
360
  new = TSV.setup({}, :key_field => key_field, :fields => fields, :type => type, :filename => filename, :identifiers => identifiers)
361
361
  self.with_unnamed do
362
362
  keys.each do |k|
363
- new[k] = self[k]
363
+ new[k] = self[k] if self.include?(k)
364
364
  end
365
365
  end
366
366
  new
@@ -18,6 +18,7 @@ Display summary information. Works with Tokyocabinet HDB and BDB as well.
18
18
  -hh--header_hash* Change the character used to mark the header line (defaults to #)
19
19
  -k--key_field* Change the key field
20
20
  -f--fields* Change the fields to load
21
+ -fp--fingerprint Fingerprint values
21
22
  -s--sep* Change the fields separator (default TAB)
22
23
  -h--help Help
23
24
  EOF
@@ -70,7 +71,11 @@ else
70
71
 
71
72
  puts "Rows: #{Log.color :blue, rows}"
72
73
  parts = []
73
- header.first_line.split(header.sep, -1).each_with_index{|p,i| parts << (Log.color(:cyan, "(#{i}) ") << p.strip) }
74
+ header.first_line.split(header.sep, -1).each_with_index do |p,i|
75
+ p.strip!
76
+ p = Misc.fingerprint p.split("|") if %w(double flat).include?(header.options[:type].to_s) && options[:fingerprint]
77
+ parts << (Log.color(:cyan, "(#{i}) ") << p.strip)
78
+ end
74
79
  puts parts * "\t"
75
80
  puts
76
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.34.14
4
+ version: 5.34.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake