statsig 1.6.0 → 1.6.1
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.
- checksums.yaml +4 -4
- data/lib/evaluation_helpers.rb +3 -11
- data/lib/evaluator.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dfdb320cf540cd81046ba96aae19d9d3f947ec557ad7fb7b405a35065eb67fa
|
4
|
+
data.tar.gz: 0e8d15d9c3f9aa0245c2e834e55394479775d2a9de23208e54dfb41be89e0326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7a479f8ed9b2cbf49f4b567bdf16000b5ba23a88015593cec6e9806477419011a13b5ed64fd578208cec5f6633101c881e3fa0b98b0474a2faebc91aaf8be1e
|
7
|
+
data.tar.gz: d731197be16b7ef43d6c9060f00254b3db3a205bef736243a326a382e9fca1aa72b1335102612ab13c044a03f4dc247e0b3443badfad147dffdd8be8391a038d
|
data/lib/evaluation_helpers.rb
CHANGED
@@ -6,19 +6,11 @@ module EvaluationHelpers
|
|
6
6
|
func.call(a.to_f, b.to_f) rescue false
|
7
7
|
end
|
8
8
|
|
9
|
-
# returns true if array contains value, ignoring case when comparing strings
|
10
|
-
def self.array_contains(array, value, ignore_case)
|
11
|
-
return false unless array.is_a?(Array) && !value.nil?
|
12
|
-
if value.is_a?(String) && match_string_in_array(array, value, ignore_case, ->(a, b) { a == b })
|
13
|
-
return true
|
14
|
-
end
|
15
|
-
return array.include?(value)
|
16
|
-
end
|
17
|
-
|
18
9
|
# returns true if array has any element that evaluates to true with value using func lambda, ignoring case
|
19
10
|
def self.match_string_in_array(array, value, ignore_case, func)
|
20
|
-
return false unless array.is_a?(Array) && value.
|
21
|
-
|
11
|
+
return false unless array.is_a?(Array) && !value.nil?
|
12
|
+
str_value = value.to_s
|
13
|
+
array.any?{ |s| !s.nil? && ((ignore_case && func.call(str_value.downcase, s.to_s.downcase)) || func.call(str_value, s.to_s)) } rescue false
|
22
14
|
end
|
23
15
|
|
24
16
|
def self.compare_times(a, b, func)
|
data/lib/evaluator.rb
CHANGED
@@ -138,13 +138,13 @@ class Evaluator
|
|
138
138
|
|
139
139
|
# array operations
|
140
140
|
when 'any'
|
141
|
-
return EvaluationHelpers::
|
141
|
+
return EvaluationHelpers::match_string_in_array(target, value, true, ->(a, b) { a == b })
|
142
142
|
when 'none'
|
143
|
-
return !EvaluationHelpers::
|
143
|
+
return !EvaluationHelpers::match_string_in_array(target, value, true, ->(a, b) { a == b })
|
144
144
|
when 'any_case_sensitive'
|
145
|
-
return EvaluationHelpers::
|
145
|
+
return EvaluationHelpers::match_string_in_array(target, value, false, ->(a, b) { a == b })
|
146
146
|
when 'none_case_sensitive'
|
147
|
-
return !EvaluationHelpers::
|
147
|
+
return !EvaluationHelpers::match_string_in_array(target, value, false, ->(a, b) { a == b })
|
148
148
|
|
149
149
|
#string
|
150
150
|
when 'str_starts_with_any'
|
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.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Statsig, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|