@@ -244,6 +244,7 @@ def variation(key, context, default)
244244 # @return [EvaluationDetail] an object describing the result
245245 #
246246 def variation_detail ( key , context , default )
247+ context = Impl ::Context ::make_context ( context )
247248 detail , _ , _ = evaluate_with_hooks ( key , context , default , :variation_detail ) do
248249 evaluate_internal ( key , context , default , true )
249250 end
@@ -263,8 +264,8 @@ def variation_detail(key, context, default)
263264 # ```
264265 #
265266 # @param key [String]
266- # @param context [String ]
267- # @param default [String ]
267+ # @param context [LDContext ]
268+ # @param default [any ]
268269 # @param method [Symbol]
269270 # @param &block [#call] Implicit passed block
270271 #
@@ -632,14 +633,15 @@ def create_default_data_source(sdk_key, config, diagnostic_accumulator)
632633 # @return [Array<EvaluationDetail, [LaunchDarkly::Impl::Model::FeatureFlag, nil], [String, nil]>]
633634 #
634635 def variation_with_flag ( key , context , default )
636+ context = Impl ::Context ::make_context ( context )
635637 evaluate_with_hooks ( key , context , default , :variation_detail ) do
636638 evaluate_internal ( key , context , default , false )
637639 end
638640 end
639641
640642 #
641643 # @param key [String]
642- # @param context [Hash, LDContext]
644+ # @param context [LDContext]
643645 # @param default [Object]
644646 # @param with_reasons [Boolean]
645647 #
@@ -656,7 +658,6 @@ def evaluate_internal(key, context, default, with_reasons)
656658 return detail , nil , "no context provided"
657659 end
658660
659- context = Impl ::Context ::make_context ( context )
660661 unless context . valid?
661662 @config . logger . error { "[LDClient] Context was invalid for evaluation of flag '#{ key } ' (#{ context . error } ); returning default value" }
662663 detail = Evaluator . error_result ( EvaluationReason ::ERROR_USER_NOT_SPECIFIED , default )
0 commit comments