unleash 5.0.5 → 5.0.7

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: 18d3ceb8b2115e259e3fb2ae66643dafea5009826a25be644ab4c98406b8ef30
4
- data.tar.gz: 3c22aed38cc800658d422dd41edfd103728e0ebf749110bf510a46259d3c2312
3
+ metadata.gz: 609118f8646c4d688a8ec3345a16cce918b75e7ab6ee3384b0f71072168047a2
4
+ data.tar.gz: 772f7b26e577e0175f474c5d552fd6df04789d800550ac1ad5daedfa372e749e
5
5
  SHA512:
6
- metadata.gz: 98a67cbdcee3d72d1aaaf5f54581875c122e58fb3dbd248bbc5c9ab0e7c55f7352dd732b12293a594412f2484535084410984b975400d991dd5b96ce02084a22
7
- data.tar.gz: a5551b86fc70c7dd6c1b80b8bb7e643524a42dc25220ca962628407a351a6886b95d7115fd77f901ed876033f131d8a112fcbb5a42dfbfa788224867b5d6bc26
6
+ metadata.gz: '00943a145724937cae025f41a877078e0e59e05097c43b1b692d234cf9115fd4418ffe63397e7f2f2e4d8b743887acb22fa36f1478f10e1dd742e7da36fc3e0c'
7
+ data.tar.gz: de046eb9f79f2bb3323901380f22d0880b4f64c7ae7bda5ccb0be98412e6133bd38721d8ed0dfc4d6c05731c364990e9c058876a267421d756feebdcce4bd07e
data/CHANGELOG.md CHANGED
@@ -13,6 +13,19 @@ Note: These changes are not considered notable:
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+
17
+ ## [5.0.7] - 2024-09-04
18
+ ### Changed
19
+ - segments now work with variants (#194)
20
+
21
+ ## [5.0.6] - 2024-08-29
22
+ ### Changed
23
+ - do not fail when case insentive enabled while having a complex context object (#191)
24
+
25
+ ## [5.0.5] - 2024-07-31
26
+ ### Changed
27
+ - emit warning when overriding a built in strategy (#187)
28
+
16
29
  ## [5.0.4] - 2024-07-15
17
30
  ### Changed
18
31
  - Reverted "feat: automatically generated instance_id (#179)" (#185)
@@ -80,7 +80,7 @@ module Unleash
80
80
  return fallback_variant
81
81
  end
82
82
 
83
- toggle = Unleash::FeatureToggle.new(toggle_as_hash)
83
+ toggle = Unleash::FeatureToggle.new(toggle_as_hash, Unleash&.segment_cache)
84
84
  variant = toggle.get_variant(context, fallback_variant)
85
85
 
86
86
  if variant.nil?
@@ -22,6 +22,8 @@ module Unleash
22
22
  FALLBACK_VALIDATOR: ->(_context_v, _constraint_v){ false }
23
23
  }.freeze
24
24
 
25
+ STRING_OPERATORS = [:STR_STARTS_WITH, :STR_ENDS_WITH, :STR_CONTAINS].freeze
26
+
25
27
  LIST_OPERATORS = [:IN, :NOT_IN, :STR_STARTS_WITH, :STR_ENDS_WITH, :STR_CONTAINS].freeze
26
28
 
27
29
  def initialize(context_name, operator, value = [], inverted: false, case_insensitive: false)
@@ -106,10 +108,10 @@ module Unleash
106
108
  v = self.value.dup
107
109
  context_value = context.get_by_name(self.context_name)
108
110
 
109
- v.map!(&:upcase) if self.case_insensitive
110
- context_value = context_value.upcase if self.case_insensitive
111
+ # always return false, if we are comparing a non string with a string operator:
112
+ return false if !context_value.is_a?(String) && STRING_OPERATORS.include?(self.operator)
111
113
 
112
- OPERATORS[self.operator].call(context_value, v)
114
+ OPERATORS[self.operator].call(*self.case_insensitive ? [context_value.upcase, v.map(&:upcase)] : [context_value, v])
113
115
  end
114
116
  end
115
117
  end
@@ -1,3 +1,3 @@
1
1
  module Unleash
2
- VERSION = "5.0.5".freeze
2
+ VERSION = "5.0.7".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleash
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renato Arruda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: murmurhash3