statsig 2.5.1 → 2.5.3

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 +24 -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: 9d2ed9517e4a8bdddd46fe4f7a143e97a4ad53ad421d2e5f66448b0a88b0c302
4
+ data.tar.gz: 23d4b29f5d3c8b456368f05a6d6caefab468b3aa5fb63e90ac0b897180619c13
5
5
  SHA512:
6
- metadata.gz: dff47718c7ea99367818542ce9dd2f5d2825577fc5b74563e6d1bf3c71677c4e524dabed63772981f5c5bd685ec16d22e86bd39b6f75c091b0343fed30fc958f
7
- data.tar.gz: 9c3b51ce54bf65e47ae8041a2dc1c8aae17f2a05e166f2c75607fc11bdb93c4b92a42dff9703dff5e0528ebf3fed8c442cb858680dadd276dc3b29692b3dfaa8
6
+ metadata.gz: f685c8419d3b2817ff26ed749552981462597ec660b019851e43f4df60ac1b61533df86282d7fb40b6212e328f2443549f9501b91cf9be92b3644233b892dcbc
7
+ data.tar.gz: 5faf75601f2ceed7bd6056db6fe8a9f646f7150f18f381d85943ad6ff304d5b1ba76757a91e0d28fbbfd25ced2aa3ec830cdd3ed08e19e0f1bdaae9febce9800
data/lib/evaluator.rb CHANGED
@@ -103,6 +103,7 @@ module Statsig
103
103
  end
104
104
 
105
105
  if @spec_store.init_reason == EvaluationReason::UNINITIALIZED
106
+ end_result.gate_value = false
106
107
  unless end_result.disable_evaluation_details
107
108
  end_result.evaluation_details = EvaluationDetails.uninitialized
108
109
  end
@@ -422,6 +423,7 @@ module Statsig
422
423
 
423
424
  def unsupported_or_unrecognized(config_name, end_result)
424
425
  end_result.rule_id = Const::EMPTY_STR
426
+ end_result.gate_value = false
425
427
 
426
428
  if end_result.disable_evaluation_details
427
429
  return
@@ -592,20 +594,34 @@ module Statsig
592
594
  pass = true
593
595
  i = 0
594
596
  memo = user.get_memo
597
+
595
598
  until i >= rule[:conditions].length
596
599
  condition_hash = rule[:conditions][i]
597
- condition = @spec_store.get_condition(condition_hash)
598
600
 
599
- if condition.nil?
601
+ eval_rule_memo = memo[:eval_rule] || {}
602
+ result = eval_rule_memo[condition_hash]
603
+
604
+ if !result.nil?
605
+ pass = false if result != true
606
+ i += 1
607
+ next
608
+ end
609
+
610
+ condition = @spec_store.get_condition(condition_hash)
611
+ result = if condition.nil?
600
612
  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)
613
+ false
604
614
  else
605
- result = Memo.for(memo, :eval_rule, condition_hash) do
606
- eval_condition(user, condition, end_result)
607
- end
615
+ eval_condition(user, condition, end_result)
616
+ end
617
+
618
+ if !@options.disable_evaluation_memoization &&
619
+ condition && condition[:type] != Const::CND_PASS_GATE && condition[:type] != Const::CND_FAIL_GATE
620
+ eval_rule_memo[condition_hash] = result
608
621
  end
622
+
623
+ memo[:eval_rule] = eval_rule_memo
624
+
609
625
  pass = false if result != true
610
626
  i += 1
611
627
  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.3',
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.3
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-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler