Skip to content

Commit 3589e46

Browse files
committed
updates
1 parent e0229a1 commit 3589e46

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

bin/commands/assess_distribution.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def run
7878
# Evaluate flag
7979
flag_evaluation = instance.is_enabled(@options.feature, context_copy)
8080
if flag_evaluation
81-
flag_evaluations["enabled"] += 1
81+
flag_evaluations[:enabled] += 1
8282
else
83-
flag_evaluations["disabled"] += 1
83+
flag_evaluations[:disabled] += 1
8484
end
8585

8686
# Evaluate variation if feature has variations

bin/commands/test.rb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ def run_tests(tests, sdk_instances_by_environment, datafiles_by_environment, seg
246246
test_duration += test_result[:duration]
247247

248248
if test_result[:has_error]
249-
results += " ✘ #{assertion['description']} (#{(test_result[:duration] * 1000).round(2)}ms)\n"
249+
results += " ✘ #{assertion[:description]} (#{(test_result[:duration] * 1000).round(2)}ms)\n"
250250
results += test_result[:errors]
251251
test_has_error = true
252252
failed_assertions_count += 1
253253
else
254-
results += " ✔ #{assertion['description']} (#{(test_result[:duration] * 1000).round(2)}ms)\n"
254+
results += " ✔ #{assertion[:description]} (#{(test_result[:duration] * 1000).round(2)}ms)\n"
255255
passed_assertions_count += 1
256256
end
257257
end
@@ -448,7 +448,7 @@ def run_test_feature(assertion, feature_key, instance, level)
448448
end
449449

450450
def run_test_feature_child(assertion, feature_key, instance, level)
451-
context = parse_context(assertion["context"])
451+
context = parse_context(assertion[:context])
452452
override_options = create_override_options(assertion)
453453

454454
has_error = false
@@ -623,41 +623,41 @@ def create_override_options(assertion)
623623

624624
def get_evaluation_value(evaluation, key)
625625
case key
626-
when "type"
626+
when :type
627627
evaluation[:type]
628-
when "featureKey"
628+
when :featureKey
629629
evaluation[:feature_key]
630-
when "reason"
630+
when :reason
631631
evaluation[:reason]
632-
when "bucketKey"
632+
when :bucketKey
633633
evaluation[:bucket_key]
634-
when "bucketValue"
634+
when :bucketValue
635635
evaluation[:bucket_value]
636-
when "ruleKey"
636+
when :ruleKey
637637
evaluation[:rule_key]
638-
when "error"
638+
when :error
639639
evaluation[:error]
640-
when "enabled"
640+
when :enabled
641641
evaluation[:enabled]
642-
when "traffic"
642+
when :traffic
643643
evaluation[:traffic]
644-
when "forceIndex"
644+
when :forceIndex
645645
evaluation[:force_index]
646-
when "force"
646+
when :force
647647
evaluation[:force]
648-
when "required"
648+
when :required
649649
evaluation[:required]
650-
when "sticky"
650+
when :sticky
651651
evaluation[:sticky]
652-
when "variation"
652+
when :variation
653653
evaluation[:variation]
654-
when "variationValue"
654+
when :variationValue
655655
evaluation[:variation_value]
656-
when "variableKey"
656+
when :variableKey
657657
evaluation[:variable_key]
658-
when "variableValue"
658+
when :variableValue
659659
evaluation[:variable_value]
660-
when "variableSchema"
660+
when :variableSchema
661661
evaluation[:variable_schema]
662662
else
663663
nil

lib/featurevisor/conditions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ def self.condition_is_matched(condition, context, get_regex)
5353
if value.is_a?(Array) && (context_value_from_path.is_a?(String) || context_value_from_path.is_a?(Numeric) || context_value_from_path.nil?)
5454
# Check if the attribute key actually exists in the context
5555
key_exists = context.key?(attribute.to_sym) || context.key?(attribute.to_s)
56-
56+
5757
# If key doesn't exist, notIn should fail (return false), in should also fail
5858
if !key_exists
5959
return false
6060
end
61-
61+
6262
value_in_context = context_value_from_path.to_s
6363

6464
if operator == "in"

lib/featurevisor/datafile_reader.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ def all_conditions_are_matched(conditions, context)
183183
end
184184
end
185185

186+
187+
186188
if conditions.is_a?(Array)
187189
return conditions.all? { |c| all_conditions_are_matched(c, context) }
188190
end
@@ -245,6 +247,8 @@ def all_segments_are_matched(group_segments, context)
245247
all_segments_are_matched({ "and" => group_segments["not"] }, context) == false
246248
end
247249
end
250+
251+
248252
end
249253

250254
if group_segments.is_a?(Array)

0 commit comments

Comments
 (0)