Sha256: 1624b091510049b04351b6caa63235a9f5a3b447385d4a7f1893feaf6f699f39
Contents?: true
Size: 1.12 KB
Versions: 51
Compression:
Stored size: 1.12 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) return if handlers.empty? # 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) node.typed_children.each do |obj_type, children| children.each do |name, node| each_node(node) { |n| yield(n) } end end end end end end
Version data entries
51 entries across 51 versions & 1 rubygems