Class: GraphQL::Query::SerialExecution::ValueResolution::BaseResolution

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/query/serial_execution/value_resolution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, field_type, target, parent_type, irep_node, execution_context) ⇒ BaseResolution

Returns a new instance of BaseResolution


12
13
14
15
16
17
18
19
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 12

def initialize(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_context
end

Instance Attribute Details

#execution_contextObject (readonly)

Returns the value of attribute execution_context


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def execution_context
  @execution_context
end

#field_typeObject (readonly)

Returns the value of attribute field_type


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def field_type
  @field_type
end

#irep_nodeObject (readonly)

Returns the value of attribute irep_node


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def irep_node
  @irep_node
end

#parent_typeObject (readonly)

Returns the value of attribute parent_type


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def parent_type
  @parent_type
end

#targetObject (readonly)

Returns the value of attribute target


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def target
  @target
end

#valueObject (readonly)

Returns the value of attribute value


10
11
12
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 10

def value
  @value
end

Instance Method Details

#get_strategy_for_kind(*args) ⇒ Object


33
34
35
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 33

def get_strategy_for_kind(*args)
  GraphQL::Query::SerialExecution::ValueResolution.get_strategy_for_kind(*args)
end

#non_null_resultObject

Raises:

  • (NotImplementedError)

29
30
31
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 29

def non_null_result
  raise NotImplementedError, "Should return a value based on initialization params"
end

#resultObject


21
22
23
24
25
26
27
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 21

def result
  if value.nil? || value.is_a?(GraphQL::ExecutionError)
    nil
  else
    non_null_result
  end
end