Module: GraphQL::Execution::Interpreter::Runtime::GraphQLResult

Included in:
GraphQLResultArray, GraphQLResultHash
Defined in:
lib/graphql/execution/interpreter/runtime/graphql_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ast_node ⇒ Object (readonly)

Returns the value of attribute ast_node.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def ast_node
  @ast_node
end

#base_path=(value) ⇒ Object (writeonly)

TODO test full path in Partial



30
31
32
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 30

def base_path=(value)
  @base_path = value
end

#graphql_application_value ⇒ Object (readonly)

Returns the value of attribute graphql_application_value.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_application_value
  @graphql_application_value
end

#graphql_arguments ⇒ Object (readonly)

Returns the value of attribute graphql_arguments.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_arguments
  @graphql_arguments
end

#graphql_dead ⇒ Object

Returns the value of attribute graphql_dead.



55
56
57
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 55

def graphql_dead
  @graphql_dead
end

#graphql_field ⇒ Object (readonly)

Returns the value of attribute graphql_field.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_field
  @graphql_field
end

#graphql_is_eager ⇒ Object (readonly)

Returns the value of attribute graphql_is_eager.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_is_eager
  @graphql_is_eager
end

#graphql_is_non_null_in_parent ⇒ Object (readonly)

Returns the value of attribute graphql_is_non_null_in_parent.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_is_non_null_in_parent
  @graphql_is_non_null_in_parent
end

#graphql_parent ⇒ Object (readonly)

Returns the value of attribute graphql_parent.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_parent
  @graphql_parent
end

#graphql_result_data ⇒ Object

Returns

  • Hash — Plain-Ruby result data (@graphql_metadata contains Result wrapper objects)


62
63
64
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 62

def graphql_result_data
  @graphql_result_data
end

#graphql_result_name ⇒ Object (readonly)

Returns the value of attribute graphql_result_name.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_result_name
  @graphql_result_name
end

#graphql_result_type ⇒ Object (readonly)

Returns the value of attribute graphql_result_type.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_result_type
  @graphql_result_type
end

#graphql_selections ⇒ Object (readonly)

Returns the value of attribute graphql_selections.



56
57
58
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 56

def graphql_selections
  @graphql_selections
end

Instance Method Details

#build_path(path_array) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 36

def build_path(path_array)
  graphql_result_name && path_array.unshift(graphql_result_name)
  if @graphql_parent
    @graphql_parent.build_path(path_array)
  elsif @base_path
    @base_path + path_array
  else
    path_array
  end
end

#depth ⇒ Object



47
48
49
50
51
52
53
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 47

def depth
  @depth ||= if @graphql_parent
    @graphql_parent.depth + 1
  else
    1
  end
end

#initialize(result_name, result_type, application_value, parent_result, is_non_null_in_parent, selections, is_eager, ast_node, graphql_arguments, graphql_field) ⇒ Object

rubocop:disable Metrics/ParameterLists



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 10

def initialize(result_name, result_type, application_value, parent_result, is_non_null_in_parent, selections, is_eager, ast_node, graphql_arguments, graphql_field) # rubocop:disable Metrics/ParameterLists
  @ast_node = ast_node
  @graphql_arguments = graphql_arguments
  @graphql_field = graphql_field
  @graphql_parent = parent_result
  @graphql_application_value = application_value
  @graphql_result_type = result_type
  if parent_result && parent_result.graphql_dead
    @graphql_dead = true
  end
  @graphql_result_name = result_name
  @graphql_is_non_null_in_parent = is_non_null_in_parent
  # Jump through some hoops to avoid creating this duplicate storage if at all possible.
  @graphql_metadata = nil
  @graphql_selections = selections
  @graphql_is_eager = is_eager
  @base_path = nil
end

#path ⇒ Object



32
33
34
# File 'lib/graphql/execution/interpreter/runtime/graphql_result.rb', line 32

def path
  @path ||= build_path([])
end