statsig 1.8.2 → 1.8.4

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: 572aeb29b8bbc76e436127efd30c2fc01d0faa66f95aca1c15fdc094e43000b4
4
- data.tar.gz: c9cfa2cfb4ae0d974d261119ab056600793febe578f2d8bf0f34c828b3e93ec5
3
+ metadata.gz: e6b5d1c640eab6b3173784683e1e87c41c97410631aaea5e9e68306cd45df829
4
+ data.tar.gz: c78cb2b73b63f496672a2486a8fb7fe212dc4192838b4cf72a5e191f9b4d065f
5
5
  SHA512:
6
- metadata.gz: 4e90695bad164518cb6f61a62b9b44c8ec2384a30d1e44d17bf4434230ddc85c56c8365b71e4d8768efda2026302e11118c60a69b0cdcbf6898d1bb6fe7d469b
7
- data.tar.gz: 2a9f90c772b22f920d2f3821c872a5d28b87d2db9da80b0d2ce66cf7ea7d3003dea337c1f2cee44ce2c14c3fd7bc8428190708a7b4da1335d6fdf8075349e94c
6
+ metadata.gz: 2b4601bb00d1287c24aceca4e85d9e4c786225d6c42a8abb8bd70ab687d6d0ce508e3e762b302306617d3f17e81d693293509aa1f1550ab3ad670c4bca464737
7
+ data.tar.gz: d5518fc18cd937879281663b1592e286fbe45cd2a222e5ef6ab7659443fb5f5db4875ba7f29d7acbe28a5f81b8bec54195123617f58db09fa442b2ec224c1559
data/lib/evaluator.rb CHANGED
@@ -159,17 +159,24 @@ module Statsig
159
159
  return EvaluationHelpers::compare_numbers(value, target, ->(a, b) { a <= b })
160
160
 
161
161
  # version comparison
162
+ # need to check for nil or empty value because Version takes them as valid values
162
163
  when 'version_gt'
164
+ return false if value.to_s.empty?
163
165
  return (Gem::Version.new(value) > Gem::Version.new(target) rescue false)
164
166
  when 'version_gte'
167
+ return false if value.to_s.empty?
165
168
  return (Gem::Version.new(value) >= Gem::Version.new(target) rescue false)
166
169
  when 'version_lt'
170
+ return false if value.to_s.empty?
167
171
  return (Gem::Version.new(value) < Gem::Version.new(target) rescue false)
168
172
  when 'version_lte'
173
+ return false if value.to_s.empty?
169
174
  return (Gem::Version.new(value) <= Gem::Version.new(target) rescue false)
170
175
  when 'version_eq'
176
+ return false if value.to_s.empty?
171
177
  return (Gem::Version.new(value) == Gem::Version.new(target) rescue false)
172
178
  when 'version_neq'
179
+ return false if value.to_s.empty?
173
180
  return (Gem::Version.new(value) != Gem::Version.new(target) rescue false)
174
181
 
175
182
  # array operations
data/lib/statsig.rb CHANGED
@@ -40,7 +40,7 @@ module Statsig
40
40
  def self.get_statsig_metadata
41
41
  {
42
42
  'sdkType' => 'ruby-server',
43
- 'sdkVersion' => '1.8.2',
43
+ 'sdkVersion' => '1.8.4',
44
44
  }
45
45
  end
46
46
 
@@ -8,10 +8,7 @@ module Statsig
8
8
  def initialize(network)
9
9
  @network = network
10
10
  @events = []
11
- @background_flush = Thread.new do
12
- sleep 60
13
- flush
14
- end
11
+ @background_flush = periodic_flush
15
12
  end
16
13
 
17
14
  def log_event(event)
@@ -46,9 +43,18 @@ module Statsig
46
43
  log_event(event)
47
44
  end
48
45
 
46
+ def periodic_flush
47
+ Thread.new do
48
+ loop do
49
+ sleep 60
50
+ flush
51
+ end
52
+ end
53
+ end
54
+
49
55
  def flush(closing = false)
50
56
  if closing
51
- @background_flush.exit
57
+ @background_flush&.exit
52
58
  end
53
59
  if @events.length == 0
54
60
  return
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler