Skip to content

Commit 7188b95

Browse files
committed
feat: reverted-to-is-primitive
1 parent 97cfdfb commit 7188b95

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/flagsmith/engine/segments/evaluator.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def evaluate_rule_conditions(rule_type, condition_results)
197197
def get_trait_value(property, context)
198198
if property.start_with?('$.')
199199
context_value = get_context_value(property, context)
200-
return context_value if !context_value.nil? && !non_primitive?(context_value)
200+
return context_value if !context_value.nil? && is_primitive?(context_value)
201201
end
202202

203203
traits = context.dig(:identity, :traits) || {}
@@ -228,14 +228,14 @@ def get_identity_key_from_context(context)
228228
"#{context[:environment][:key]}_#{context[:identity][:identifier]}"
229229
end
230230

231-
# Check if value is non-primitive (object or array)
231+
# Check if value is primitive (not an object or array)
232232
#
233233
# @param value [Object] The value to check
234-
# @return [Boolean] True if value is an object or array
235-
def non_primitive?(value)
236-
return false if value.nil?
234+
# @return [Boolean] True if value is primitive (not an object or array)
235+
def is_primitive?(value)
236+
return true if value.nil?
237237

238-
value.is_a?(Hash) || value.is_a?(Array)
238+
!(value.is_a?(Hash) || value.is_a?(Array))
239239
end
240240

241241
private

0 commit comments

Comments
 (0)