Skip to content

Commit 6420d15

Browse files
committed
feat: linter-rubocop-autocorrect
1 parent fe63b45 commit 6420d15

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

lib/flagsmith/engine/evaluation/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def evaluate_features(evaluation_context, segment_overrides)
9494

9595
# Set reason
9696
flag_result[:reason] = evaluated[:reason] ||
97-
(has_override ? "#{TARGETING_REASON_TARGETING_MATCH}; segment=#{segment_override[:segment_name]}" : TARGETING_REASON_DEFAULT)
97+
(has_override ? "#{TARGETING_REASON_TARGETING_MATCH}; segment=#{segment_override[:segment_name]}" : TARGETING_REASON_DEFAULT)
9898
flags[final_feature[:name].to_sym] = flag_result
9999
end
100100

lib/flagsmith/engine/segments/evaluator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ module Segments
1313
module Evaluator
1414
include Flagsmith::Engine::Segments::Constants
1515
include Flagsmith::Engine::Utils::HashFunc
16-
16+
1717
# Model-based segment evaluation (existing approach)
1818
def get_identity_segments(environment, identity, override_traits = nil)
1919
environment.project.segments.select do |s|
2020
evaluate_identity_in_segment(identity, s, override_traits)
2121
end
2222
end
2323

24-
2524
def traits_match_segment_condition(identity_traits, condition, segment_id, identity_id)
2625
if condition.operator == PERCENTAGE_SPLIT
2726
return hashed_percentage_for_object_ids([segment_id,
@@ -38,8 +37,8 @@ def traits_match_segment_condition(identity_traits, condition, segment_id, ident
3837
false
3938
end
4039

41-
4240
module_function
41+
4342
# Context-based segment evaluation (new approach)
4443
# Returns all segments that the identity belongs to based on segment rules evaluation
4544
#
@@ -211,6 +210,7 @@ def get_trait_value(property, context)
211210
# @return [Object, nil] The value at the path or nil
212211
def get_context_value(json_path, context)
213212
return nil unless context && json_path&.start_with?('$.')
213+
214214
results = JsonPath.new(json_path, use_symbols: true).on(context)
215215
results.first
216216
rescue StandardError

lib/flagsmith/engine/segments/models.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ def match_modulo_value(trait_value)
102102

103103
def match_in_value(trait_value)
104104
return false if trait_value.nil? || trait_value.is_a?(TrueClass) || trait_value.is_a?(FalseClass)
105-
106-
return false unless ![true, false].include? trait_value
107105

108-
if @value.is_a?(Array)
109-
return @value.include?(trait_value.to_s)
110-
end
106+
return false if [true, false].include? trait_value
107+
108+
return @value.include?(trait_value.to_s) if @value.is_a?(Array)
111109

112110
if @value.is_a?(String)
113111
begin

0 commit comments

Comments
 (0)