@@ -245,6 +245,7 @@ def variation(key, context, default)
245245 # @return [EvaluationDetail] an object describing the result
246246 #
247247 def variation_detail ( key , context , default )
248+ context = Impl ::Context ::make_context ( context )
248249 detail , _ , _ = evaluate_with_hooks ( key , context , default , :variation_detail ) do
249250 evaluate_internal ( key , context , default , true )
250251 end
@@ -264,8 +265,8 @@ def variation_detail(key, context, default)
264265 # ```
265266 #
266267 # @param key [String]
267- # @param context [String ]
268- # @param default [String ]
268+ # @param context [LDContext ]
269+ # @param default [any ]
269270 # @param method [Symbol]
270271 # @param &block [#call] Implicit passed block
271272 #
@@ -633,14 +634,15 @@ def create_default_data_source(sdk_key, config, diagnostic_accumulator)
633634 # @return [Array<EvaluationDetail, [LaunchDarkly::Impl::Model::FeatureFlag, nil], [String, nil]>]
634635 #
635636 def variation_with_flag ( key , context , default )
637+ context = Impl ::Context ::make_context ( context )
636638 evaluate_with_hooks ( key , context , default , :variation_detail ) do
637639 evaluate_internal ( key , context , default , false )
638640 end
639641 end
640642
641643 #
642644 # @param key [String]
643- # @param context [Hash, LDContext]
645+ # @param context [LDContext]
644646 # @param default [Object]
645647 # @param with_reasons [Boolean]
646648 #
@@ -657,7 +659,6 @@ def evaluate_internal(key, context, default, with_reasons)
657659 return detail , nil , "no context provided"
658660 end
659661
660- context = Impl ::Context ::make_context ( context )
661662 unless context . valid?
662663 @config . logger . error { "[LDClient] Context was invalid for evaluation of flag '#{ key } ' (#{ context . error } ); returning default value" }
663664 detail = Evaluator . error_result ( EvaluationReason ::ERROR_USER_NOT_SPECIFIED , default )
0 commit comments