statsig 2.5.0 → 2.5.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/evaluator.rb +22 -5
  3. data/lib/statsig.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d4842b01ba9c40089bbf689984a0c9a59234d83f0d070c2570856335ad012fc
4
- data.tar.gz: 44afa2a46886c397ecc2975f123d9808f08548fadd7e9703130cd6099033d159
3
+ metadata.gz: d4a6d7a7d78f225ba3becd4a89c120f84be707306bb30067c99d20ba5e82e38f
4
+ data.tar.gz: 1714c16d5fa434cda47e3f0d7ed94510fd4f6d9892720d86e83103712dd73f6d
5
5
  SHA512:
6
- metadata.gz: 13ec911e8fb874d705ace7bc92d857dfa8a71171812b822f2af2826e9f52af01d03af8661bfd42866d7c7560b5a050a9ff2e936084eb61d18a46c67555bf5ea7
7
- data.tar.gz: 61c0be14ffc93a7bc0db3fe25932a09e8dab52fdb7eaf50b2e15ffef44cba975ddf5706b328ba8f9e0eef6ef0b744856b691efbfae72c247fb58a0d04465a86e
6
+ metadata.gz: 7f01522fd0fa7dd567aa08fb0f363170ba310ec65ad56f22cdbe3b827911e948feaeb81e8d578a85b2b4210cb8abd61d01e01a0744ff3ea0a901ccfc5fa315ce
7
+ data.tar.gz: 64dd4358abc8168ebaac7b26e5859f29e45a41a2c02a6b8dcf63e8696a54de70d50da1f9bce3fe095250e7c4eb63e4012dada16d06e47955e19983b73932537c
data/lib/evaluator.rb CHANGED
@@ -591,19 +591,36 @@ module Statsig
591
591
  def eval_rule(user, rule, end_result)
592
592
  pass = true
593
593
  i = 0
594
+ memo = user.get_memo
594
595
 
595
596
  until i >= rule[:conditions].length
596
597
  condition_hash = rule[:conditions][i]
597
- condition = @spec_store.get_condition(condition_hash)
598
598
 
599
- if condition.nil?
599
+ eval_rule_memo = memo[:eval_rule] || {}
600
+ result = eval_rule_memo[condition_hash]
601
+
602
+ if !result.nil?
603
+ pass = false if result != true
604
+ i += 1
605
+ next
606
+ end
607
+
608
+ condition = @spec_store.get_condition(condition_hash)
609
+ result = if condition.nil?
600
610
  puts "[Statsig]: Warning - Condition with hash #{condition_hash} could not be found."
601
- pass = false
611
+ false
602
612
  else
603
- result = eval_condition(user, condition, end_result)
604
- pass = false if result != true
613
+ eval_condition(user, condition, end_result)
614
+ end
615
+
616
+ if !@options.disable_evaluation_memoization &&
617
+ condition && condition[:type] != Const::CND_PASS_GATE && condition[:type] != Const::CND_FAIL_GATE
618
+ eval_rule_memo[condition_hash] = result
605
619
  end
620
+
621
+ memo[:eval_rule] = eval_rule_memo
606
622
 
623
+ pass = false if result != true
607
624
  i += 1
608
625
  end
609
626
 
data/lib/statsig.rb CHANGED
@@ -386,7 +386,7 @@ module Statsig
386
386
  def self.get_statsig_metadata
387
387
  {
388
388
  'sdkType' => 'ruby-server',
389
- 'sdkVersion' => '2.5.0',
389
+ 'sdkVersion' => '2.5.2',
390
390
  'languageVersion' => RUBY_VERSION
391
391
  }
392
392
  end
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: 2.5.0
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-27 00:00:00.000000000 Z
11
+ date: 2025-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler