configcat 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configcat/rolloutevaluator.rb +19 -19
- data/lib/configcat/version.rb +1 -1
- 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: 7b1a942248d64106cb8d048e1b036bb0d9533ddec927e6c40de53792c7cb50a2
|
4
|
+
data.tar.gz: 1fc92424f560cb36f8fc272fca29c7fbeba155f734cd9269bcba75614d632e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfcb859602316a2c538230088fd3b49739173ed2edaf927886b000a497d18a4c9c2857c06fdb40280a22715f6cf2c9d5390a5697c3aedbc95e0e697aff3f3fbf
|
7
|
+
data.tar.gz: 2d9dc0884143badeee4a246037abb80c09bd2cae1247241ca7d750647f67951bb45b23d3be17768468968ac9ea81f1e66156b5e2b152a678dbaf943274aade27
|
@@ -19,7 +19,7 @@ module ConfigCat
|
|
19
19
|
|
20
20
|
setting_descriptor = config.fetch(key, nil)
|
21
21
|
if setting_descriptor === nil
|
22
|
-
ConfigCat.logger.error("Evaluating get_value('%s') failed. Value not found for key '%s' Returning default_value: [%s]. Here are the available keys: %s" % [key, key, default_value.to_s, config.keys.join(", ")])
|
22
|
+
ConfigCat.logger.error("Evaluating get_value('%s') failed. Value not found for key '%s'. Returning default_value: [%s]. Here are the available keys: %s" % [key, key, default_value.to_s, config.keys.join(", ")])
|
23
23
|
return default_value
|
24
24
|
end
|
25
25
|
|
@@ -49,7 +49,7 @@ module ConfigCat
|
|
49
49
|
|
50
50
|
user_value = user.get_attribute(comparison_attribute)
|
51
51
|
if user_value === nil || !user_value
|
52
|
-
ConfigCat.logger.info(format_no_match_rule(comparison_attribute, comparator, comparison_value))
|
52
|
+
ConfigCat.logger.info(format_no_match_rule(comparison_attribute, user_value, comparator, comparison_value))
|
53
53
|
next
|
54
54
|
end
|
55
55
|
|
@@ -58,25 +58,25 @@ module ConfigCat
|
|
58
58
|
# IS ONE OF
|
59
59
|
if comparator == 0
|
60
60
|
if comparison_value.to_s.split(",").map { |x| x.strip() }.include?(user_value.to_s)
|
61
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
61
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
62
62
|
return value
|
63
63
|
end
|
64
64
|
# IS NOT ONE OF
|
65
65
|
elsif comparator == 1
|
66
66
|
if !comparison_value.to_s.split(",").map { |x| x.strip() }.include?(user_value.to_s)
|
67
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
67
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
68
68
|
return value
|
69
69
|
end
|
70
70
|
# CONTAINS
|
71
71
|
elsif comparator == 2
|
72
72
|
if user_value.to_s.include?(comparison_value.to_s)
|
73
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
73
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
74
74
|
return value
|
75
75
|
end
|
76
76
|
# DOES NOT CONTAIN
|
77
77
|
elsif comparator == 3
|
78
78
|
if !user_value.to_s.include?(comparison_value.to_s)
|
79
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
79
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
80
80
|
return value
|
81
81
|
end
|
82
82
|
# IS ONE OF, IS NOT ONE OF (Semantic version)
|
@@ -89,11 +89,11 @@ module ConfigCat
|
|
89
89
|
match = (user_value_version == version) || match
|
90
90
|
}
|
91
91
|
if match && comparator == 4 || !match && comparator == 5
|
92
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
92
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
93
93
|
return value
|
94
94
|
end
|
95
95
|
rescue ArgumentError => e
|
96
|
-
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, comparator, comparison_value, e.to_s))
|
96
|
+
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, user_value, comparator, comparison_value, e.to_s))
|
97
97
|
next
|
98
98
|
end
|
99
99
|
# LESS THAN, LESS THAN OR EQUALS TO, GREATER THAN, GREATER THAN OR EQUALS TO (Semantic version)
|
@@ -105,11 +105,11 @@ module ConfigCat
|
|
105
105
|
(comparator == 7 && user_value_version <= comparison_value_version) ||
|
106
106
|
(comparator == 8 && user_value_version > comparison_value_version) ||
|
107
107
|
(comparator == 9 && user_value_version >= comparison_value_version)
|
108
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
108
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
109
109
|
return value
|
110
110
|
end
|
111
111
|
rescue ArgumentError => e
|
112
|
-
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, comparator, comparison_value, e.to_s))
|
112
|
+
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, user_value, comparator, comparison_value, e.to_s))
|
113
113
|
next
|
114
114
|
end
|
115
115
|
elsif (10 <= comparator) && (comparator <= 15)
|
@@ -122,16 +122,16 @@ module ConfigCat
|
|
122
122
|
(comparator == 13 && user_value_float <= comparison_value_float) ||
|
123
123
|
(comparator == 14 && user_value_float > comparison_value_float) ||
|
124
124
|
(comparator == 15 && user_value_float >= comparison_value_float)
|
125
|
-
ConfigCat.logger.info(format_match_rule(comparison_attribute, comparator, comparison_value, value))
|
125
|
+
ConfigCat.logger.info(format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value))
|
126
126
|
return value
|
127
127
|
end
|
128
128
|
rescue Exception => e
|
129
|
-
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, comparator, comparison_value, e.to_s))
|
129
|
+
ConfigCat.logger.warn(format_validation_error_rule(comparison_attribute, user_value, comparator, comparison_value, e.to_s))
|
130
130
|
next
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
ConfigCat.logger.info(format_no_match_rule(comparison_attribute, comparator, comparison_value))
|
134
|
+
ConfigCat.logger.info(format_no_match_rule(comparison_attribute, user_value, comparator, comparison_value))
|
135
135
|
end
|
136
136
|
|
137
137
|
if rollout_percentage_items.size > 0
|
@@ -155,16 +155,16 @@ module ConfigCat
|
|
155
155
|
|
156
156
|
private
|
157
157
|
|
158
|
-
def self.format_match_rule(comparison_attribute, comparator, comparison_value, value)
|
159
|
-
return "Evaluating rule: [%s] [%s] [%s] => match, returning: %s" % [comparison_attribute, COMPARATOR_TEXTS[comparator], comparison_value, value]
|
158
|
+
def self.format_match_rule(comparison_attribute, user_value, comparator, comparison_value, value)
|
159
|
+
return "Evaluating rule: [%s:%s] [%s] [%s] => match, returning: %s" % [comparison_attribute, user_value, COMPARATOR_TEXTS[comparator], comparison_value, value]
|
160
160
|
end
|
161
161
|
|
162
|
-
def self.format_no_match_rule(comparison_attribute, comparator, comparison_value)
|
163
|
-
return "Evaluating rule: [%s] [%s] [%s] => no match" % [comparison_attribute, COMPARATOR_TEXTS[comparator], comparison_value]
|
162
|
+
def self.format_no_match_rule(comparison_attribute, user_value, comparator, comparison_value)
|
163
|
+
return "Evaluating rule: [%s:%s] [%s] [%s] => no match" % [comparison_attribute, user_value, COMPARATOR_TEXTS[comparator], comparison_value]
|
164
164
|
end
|
165
165
|
|
166
|
-
def self.format_validation_error_rule(comparison_attribute, comparator, comparison_value, error)
|
167
|
-
return "Evaluating rule: [%s] [%s] [%s] => SKIP rule. Validation error: %s" % [comparison_attribute, COMPARATOR_TEXTS[comparator], comparison_value, error]
|
166
|
+
def self.format_validation_error_rule(comparison_attribute, user_value, comparator, comparison_value, error)
|
167
|
+
return "Evaluating rule: [%s:%s] [%s] [%s] => SKIP rule. Validation error: %s" % [comparison_attribute, user_value, COMPARATOR_TEXTS[comparator], comparison_value, error]
|
168
168
|
end
|
169
169
|
|
170
170
|
end
|
data/lib/configcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ConfigCat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|