statsig 2.5.1 → 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 -8
  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: 270fe13b6b756794826634e8256e0ffd19ff1df35c265942e721fe7c81807ac9
4
- data.tar.gz: 96d33f20e9df4c35291e88a84a816336f183e70189c0cfb4f6a21ba7859e65b4
3
+ metadata.gz: d4a6d7a7d78f225ba3becd4a89c120f84be707306bb30067c99d20ba5e82e38f
4
+ data.tar.gz: 1714c16d5fa434cda47e3f0d7ed94510fd4f6d9892720d86e83103712dd73f6d
5
5
  SHA512:
6
- metadata.gz: dff47718c7ea99367818542ce9dd2f5d2825577fc5b74563e6d1bf3c71677c4e524dabed63772981f5c5bd685ec16d22e86bd39b6f75c091b0343fed30fc958f
7
- data.tar.gz: 9c3b51ce54bf65e47ae8041a2dc1c8aae17f2a05e166f2c75607fc11bdb93c4b92a42dff9703dff5e0528ebf3fed8c442cb858680dadd276dc3b29692b3dfaa8
6
+ metadata.gz: 7f01522fd0fa7dd567aa08fb0f363170ba310ec65ad56f22cdbe3b827911e948feaeb81e8d578a85b2b4210cb8abd61d01e01a0744ff3ea0a901ccfc5fa315ce
7
+ data.tar.gz: 64dd4358abc8168ebaac7b26e5859f29e45a41a2c02a6b8dcf63e8696a54de70d50da1f9bce3fe095250e7c4eb63e4012dada16d06e47955e19983b73932537c
data/lib/evaluator.rb CHANGED
@@ -592,20 +592,34 @@ module Statsig
592
592
  pass = true
593
593
  i = 0
594
594
  memo = user.get_memo
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
- result = false
602
- elsif condition[:type] == Const::CND_FAIL_GATE || condition[:type] == Const::CND_PASS_GATE
603
- result = eval_condition(user, condition, end_result)
611
+ false
604
612
  else
605
- result = Memo.for(memo, :eval_rule, condition_hash) do
606
- eval_condition(user, condition, end_result)
607
- end
613
+ eval_condition(user, condition, end_result)
608
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
619
+ end
620
+
621
+ memo[:eval_rule] = eval_rule_memo
622
+
609
623
  pass = false if result != true
610
624
  i += 1
611
625
  end
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.1',
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.1
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-06-07 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