moduleGraphQLclassQueryclassSerialExecutionmoduleValueResolutiondefself.get_strategy_for_kind(kind)TYPE_KIND_STRATEGIES[kind]||raise("No value resolution strategy for #{kind}!")endclassBaseResolutionattr_reader:value,:field_type,:target,:parent_type,:irep_node,:execution_contextdefinitialize(value,field_type,target,parent_type,irep_node,execution_context)@value=value@field_type=field_type@target=target@parent_type=parent_type@irep_node=irep_node@execution_context=execution_contextenddefresultreturnnilifvalue.nil?||value.is_a?(GraphQL::ExecutionError)non_null_resultenddefnon_null_resultraiseNotImplementedError,"Should return a value based on initialization params"enddefget_strategy_for_kind(*args)GraphQL::Query::SerialExecution::ValueResolution.get_strategy_for_kind(*args)endendclassScalarResolution<BaseResolution# Apply the scalar's defined `coerce_result` method to the valuedefnon_null_resultfield_type.coerce_result(value)endendclassListResolution<BaseResolution# For each item in the list,# Resolve it with the "wrapped" type of this listdefnon_null_resultwrapped_type=field_type.of_typestrategy_class=get_strategy_for_kind(wrapped_type.kind)value.mapdo|item|inner_strategy=strategy_class.new(item,wrapped_type,target,parent_type,irep_node,execution_context)inner_strategy.resultendendendclassHasPossibleTypeResolution<BaseResolutiondefnon_null_result# When deprecations are removed:# resolved_type = execution_context.schema.resolve_type(value)resolved_type=field_type.legacy_resolve_type(value,execution_context)unlessresolved_type.is_a?(GraphQL::ObjectType)raiseGraphQL::ObjectType::UnresolvedTypeError.new(irep_node.definition_name,field_type,parent_type)endstrategy_class=get_strategy_for_kind(resolved_type.kind)inner_strategy=strategy_class.new(value,resolved_type,target,parent_type,irep_node,execution_context)inner_strategy.resultendendclassObjectResolution<BaseResolution# Resolve the selections on this objectdefnon_null_resultexecution_context.strategy.selection_resolution.new(value,field_type,irep_node,execution_context).resultendendclassNonNullResolution<BaseResolution# Get the "wrapped" type and resolve the value according to that typedefresultifvalue.nil?||value.is_a?(GraphQL::ExecutionError)raiseGraphQL::InvalidNullError.new(irep_node.definition_name,value)elsewrapped_type=field_type.of_typestrategy_class=get_strategy_for_kind(wrapped_type.kind)inner_strategy=strategy_class.new(value,wrapped_type,target,parent_type,irep_node,execution_context)inner_strategy.resultendendendTYPE_KIND_STRATEGIES={GraphQL::TypeKinds::SCALAR=>ScalarResolution,GraphQL::TypeKinds::LIST=>ListResolution,GraphQL::TypeKinds::OBJECT=>ObjectResolution,GraphQL::TypeKinds::ENUM=>ScalarResolution,GraphQL::TypeKinds::NON_NULL=>NonNullResolution,GraphQL::TypeKinds::INTERFACE=>HasPossibleTypeResolution,GraphQL::TypeKinds::UNION=>HasPossibleTypeResolution,}endendendend