Sha256: 62a39809d4b8267a8793eb12fc30eecb0dfd30259df4e10a0c803e6ccd1c9841
Contents?: true
Size: 1.17 KB
Versions: 36
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module GraphQL module InternalRepresentation # Traverse a re-written query tree, calling handlers for each node module Visit module_function def visit_each_node(operations, handlers) # Post-validation: make some assertions about the rewritten query tree operations.each do |op_name, op_node| # Yield each node to listeners which were attached by validators op_node.typed_children.each do |obj_type, children| children.each do |name, op_child_node| each_node(op_child_node) do |node| for h in handlers h.call(node) end end end end end end # Traverse a node in a rewritten query tree, # visiting the node itself and each of its typed children. def each_node(node) yield(node) if node.typed_children.any? visit_block = Proc.new node.typed_children.each do |obj_type, children| children.each do |name, node| each_node(node, &visit_block) end end end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems