Class: GraphQL::Analysis::AST::Analyzer
- Inherits:
-
Object
- Object
- GraphQL::Analysis::AST::Analyzer
- 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
Class Method Summary collapse
-
.build_visitor_hooks(member_name) ⇒ Object
Don’t use make_visit_method because it breaks
super
.
Instance Method Summary collapse
-
#analyze? ⇒ Boolean
Analyzer hook to decide at analysis time whether a query should be analyzed or not.
-
#initialize(query) ⇒ Analyzer
constructor
A new instance of Analyzer.
-
#result ⇒ Any
The result for this analyzer.
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 |
Class Method Details
.build_visitor_hooks(member_name) ⇒ Object
Don’t use make_visit_method because it breaks super
29 30 31 32 33 34 35 36 37 |
# File 'lib/graphql/analysis/ast/analyzer.rb', line 29 def self.build_visitor_hooks(member_name) class_eval(<<-EOS, __FILE__, __LINE__ + 1) def on_enter_#{member_name}(node, parent, visitor) end def on_leave_#{member_name}(node, parent, visitor) end EOS end |
Instance Method Details
#analyze? ⇒ Boolean
Analyzer hook to decide at analysis time whether a query should be analyzed or not.
17 18 19 |
# File 'lib/graphql/analysis/ast/analyzer.rb', line 17 def analyze? true end |
#result ⇒ Any
The result for this analyzer. Returning GraphQL::AnalysisError results in a query error.
24 25 26 |
# File 'lib/graphql/analysis/ast/analyzer.rb', line 24 def result raise NotImplementedError end |