Class: GraphQL::Analysis::AST::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/analysis/ast/analyzer.rb

Overview

Query analyzer for query ASTs. Query analyzers respond to visitor style methods but are prefixed by enter and leave.

Direct Known Subclasses

FieldUsage, QueryComplexity, QueryDepth

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ Analyzer

Returns a new instance of Analyzer



10
11
12
# File 'lib/graphql/analysis/ast/analyzer.rb', line 10

def initialize(query)
  @query = query
end

Instance Method Details

#analyze?Boolean

Analyzer hook to decide at analysis time whether a query should be analyzed or not.

Returns:

  • (Boolean)

    If the query should be analyzed or not



17
18
19
# File 'lib/graphql/analysis/ast/analyzer.rb', line 17

def analyze?
  true
end

#resultAny

The result for this analyzer. Returning GraphQL::AnalysisError results in a query error.

Returns:

  • (Any)

    The analyzer result

Raises:



24
25
26
# File 'lib/graphql/analysis/ast/analyzer.rb', line 24

def result
  raise GraphQL::RequiredImplementationMissingError
end