Method: GraphQL::Language::Visitor#on_document_children

Defined in:
lib/graphql/language/visitor.rb

#on_document_children(document_node) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/graphql/language/visitor.rb', line 64

def on_document_children(document_node)
  new_node = document_node
  document_node.children.each do |child_node|
    visit_method = :"#{child_node.visit_method}_with_modifications"
    new_child_and_node = public_send(visit_method, child_node, new_node)
    # Reassign `node` in case the child hook makes a modification
    if new_child_and_node.is_a?(Array)
      new_node = new_child_and_node[1]
    end
  end
  new_node
end