class GraphQL::Language::Nodes::Document

This is the AST root for normal queries

@example Deriving a document by parsing a string

document = GraphQL.parse(query_string)

@example Creating a string from a document

document.to_query_string
# { ... }

@example Creating a custom string from a document

class VariableScrubber < GraphQL::Language::Printer
  def print_argument(arg)
    "#{arg.name}: <HIDDEN>"
  end
end

document.to_query_string(printer: VariableScrubber.new)

Public Instance Methods

slice_definition(name) click to toggle source

@!attribute definitions

@return [Array<OperationDefinition, FragmentDefinition>] top-level GraphQL units: operations or fragments
# File lib/graphql/language/nodes.rb, line 352
def slice_definition(name)
  GraphQL::Language::DefinitionSlice.slice(self, name)
end