splitclient-rb 8.4.0 → 8.4.1.pre.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4566bc73b33d8770b7727b8c2274355e9b838bdb3b709319b2c4c1d0f5d0d2cd
4
- data.tar.gz: cb2f7f391dbc3bdacea7e0837167e06cef4a634c44b6094343a34a96507390d0
3
+ metadata.gz: 8f5c4eeedc44963558586b999cd4f33c39ca80f5bfc4c80041a740b588e94595
4
+ data.tar.gz: 34373355b4b0657fa86a44522ae33d23a8a0fb3b2db43dd78d0b2cfaee33b1d0
5
5
  SHA512:
6
- metadata.gz: 0e5c7b8592942081ad7f324e00facdf5341c632810fc0520ba9a97512795895c06f3d35ef17a14e0d07e60fb9c8b8abb16af5cc0988a5c454a8e447e21e2aaf1
7
- data.tar.gz: 9ddc716be18d0a53b4835795681d6a375188bce1481cd0bcbe0d3be73d485344486c88ac7326f25af6d9290a0c987427ae8abfd087ca1e6832b06c4ee9194784
6
+ metadata.gz: 6e6bc70886bd26787fa73a3d98e7840d7338d2431595de4f588b59a2861b91de165ba97e2eb6ad21685920aa0a18095f1bdd00ffc5b5d7c4d55c3d79ba8c52cc
7
+ data.tar.gz: 84461ff3ae4dfc419249387ae86503e28ec00971d93d24dd138d7669c299b368488ce8ec9d09b9e1f0e8228da377ae9965900398bc745ca1a8b2d461bc416c3e
@@ -8,8 +8,8 @@ module SplitIoClient
8
8
  class BloomFilter
9
9
  def initialize(capacity, false_positive_probability = 0.001)
10
10
  @capacity = capacity.round
11
- m = best_m(capacity, false_positive_probability)
12
- @ba = BitArray.new(m.round)
11
+ @m = best_m(capacity, false_positive_probability)
12
+ reset_filter
13
13
  @k = best_k(capacity)
14
14
  end
15
15
 
@@ -17,22 +17,26 @@ module SplitIoClient
17
17
  return false if contains?(string)
18
18
 
19
19
  positions = hashes(string)
20
-
21
20
  positions.each { |position| @ba[position] = 1 }
22
21
 
23
22
  true
24
23
  end
25
-
24
+
26
25
  def contains?(string)
27
26
  !hashes(string).any? { |ea| @ba[ea] == 0 }
28
27
  end
29
28
 
30
29
  def clear
31
- @ba.size.times { |i| @ba[i] = 0 }
30
+ @ba = nil
31
+ reset_filter
32
32
  end
33
-
33
+
34
34
  private
35
35
 
36
+ def reset_filter
37
+ @ba = BitArray.new(@m.round)
38
+ end
39
+
36
40
  # m is the required number of bits in the array
37
41
  def best_m(capacity, false_positive_probability)
38
42
  -(capacity * Math.log(false_positive_probability)) / (Math.log(2) ** 2)
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.4.0'
2
+ VERSION = '8.4.1-rc1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.4.0
4
+ version: 8.4.1.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-03 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allocation_stats
@@ -590,11 +590,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
590
590
  version: 2.5.0
591
591
  required_rubygems_version: !ruby/object:Gem::Requirement
592
592
  requirements:
593
- - - ">="
593
+ - - ">"
594
594
  - !ruby/object:Gem::Version
595
- version: '0'
595
+ version: 1.3.1
596
596
  requirements: []
597
- rubygems_version: 3.2.3
597
+ rubygems_version: 3.4.10
598
598
  signing_key:
599
599
  specification_version: 4
600
600
  summary: Ruby client for split SDK.