cdb-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cdb/reader.rb +3 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfee6b5d54015ab9d2678b0e17321601595cd118
4
- data.tar.gz: 01c7b55334e64ba01906cd08229aaea48db7eec4
3
+ metadata.gz: 1568b9d3e0a0c612b8f90b0a8ec85f5762f72d44
4
+ data.tar.gz: 366fb91e7f118e7840a8adac941a6d5b03eff436
5
5
  SHA512:
6
- metadata.gz: ab3157637d9bfae8afa30965fb540a11ba895246bfe9024161b2698de2063c5813bca58babb7e6f8da00e7c712c9df8aa08b64285bce0fcbf37a4c2eb40be448
7
- data.tar.gz: 4d4be6eafe86f40ad662c41f354c7fad5147b42b524b8f8dff4e442361670c1a4d1f24f89738ecda75be078140f2111ba14a36f635bf3c32e03b3d9bf9144ff3
6
+ metadata.gz: 521545ffd0fc76312a2bb6a036893565791242eddb887fd38468602def95a08852a1bbcedd38a0e72575aff5a4dfdbba029809cf7dc274e1540520b37a00e110
7
+ data.tar.gz: 275a44e9088a6cdaa906828e43e31feea1930e076a376a1317a8b03cfe4097dab0a863d80279c744bd9ed6f013b9953196afecf9a4a298b76977e4d296fb726f
data/lib/cdb/reader.rb CHANGED
@@ -18,13 +18,12 @@ module Cdb
18
18
  private
19
19
 
20
20
  def key_from_table(table, key, hash)
21
- index = (hash / Cdb::NUM_HASHTABLES) % table.length
22
- loop do
23
- entry_hash, offset = table[index]
21
+ initial = (hash / Cdb::NUM_HASHTABLES) % table.length
22
+ (0...table.length).each do |n|
23
+ entry_hash, offset = table[(initial + n) % table.length]
24
24
  return nil if offset.zero?
25
25
  value = maybe_read_value(offset, key) if entry_hash == hash
26
26
  return value unless value.nil?
27
- index = (index + 1) % table.length
28
27
  end
29
28
  end
30
29
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdb-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olly Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: olly.smith@gmail.com