@@ -245,6 +245,7 @@ def variation(key, context, default)
245
245
# @return [EvaluationDetail] an object describing the result
246
246
#
247
247
def variation_detail ( key , context , default )
248
+ context = Impl ::Context ::make_context ( context )
248
249
detail , _ , _ = evaluate_with_hooks ( key , context , default , :variation_detail ) do
249
250
evaluate_internal ( key , context , default , true )
250
251
end
@@ -264,8 +265,8 @@ def variation_detail(key, context, default)
264
265
# ```
265
266
#
266
267
# @param key [String]
267
- # @param context [String ]
268
- # @param default [String ]
268
+ # @param context [LDContext ]
269
+ # @param default [any ]
269
270
# @param method [Symbol]
270
271
# @param &block [#call] Implicit passed block
271
272
#
@@ -633,14 +634,15 @@ def create_default_data_source(sdk_key, config, diagnostic_accumulator)
633
634
# @return [Array<EvaluationDetail, [LaunchDarkly::Impl::Model::FeatureFlag, nil], [String, nil]>]
634
635
#
635
636
def variation_with_flag ( key , context , default )
637
+ context = Impl ::Context ::make_context ( context )
636
638
evaluate_with_hooks ( key , context , default , :variation_detail ) do
637
639
evaluate_internal ( key , context , default , false )
638
640
end
639
641
end
640
642
641
643
#
642
644
# @param key [String]
643
- # @param context [Hash, LDContext]
645
+ # @param context [LDContext]
644
646
# @param default [Object]
645
647
# @param with_reasons [Boolean]
646
648
#
@@ -657,7 +659,6 @@ def evaluate_internal(key, context, default, with_reasons)
657
659
return detail , nil , "no context provided"
658
660
end
659
661
660
- context = Impl ::Context ::make_context ( context )
661
662
unless context . valid?
662
663
@config . logger . error { "[LDClient] Context was invalid for evaluation of flag '#{ key } ' (#{ context . error } ); returning default value" }
663
664
detail = Evaluator . error_result ( EvaluationReason ::ERROR_USER_NOT_SPECIFIED , default )
0 commit comments