Class: GraphQL::StaticValidation::BaseVisitor
- Inherits:
 - 
      Language::Visitor
      
        
- Object
 - Language::Visitor
 - GraphQL::StaticValidation::BaseVisitor
 
 
- Defined in:
 - lib/graphql/static_validation/base_visitor.rb
 
Direct Known Subclasses
Defined Under Namespace
Modules: ContextMethods
Constant Summary
Constants inherited from Language::Visitor
Language::Visitor::DELETE_NODE, Language::Visitor::SKIP
Instance Attribute Summary collapse
- 
  
    
      #context  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute context.
 - 
  
    
      #object_types  ⇒ Array<GraphQL::ObjectType> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Types whose scope we’ve entered.
 
Attributes inherited from Language::Visitor
Class Method Summary collapse
- 
  
    
      .including_rules(rules)  ⇒ Class 
    
    
  
  
  
  
  
  
  
  
  
    
Build a class to visit the AST and perform validation, or use a pre-built class if rules is
ALL_RULESor empty. 
Instance Method Summary collapse
- 
  
    
      #initialize(document, context)  ⇒ BaseVisitor 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of BaseVisitor.
 - 
  
    
      #path  ⇒ Array<String> 
    
    
  
  
  
  
  
  
  
  
  
    
The nesting of the current position in the AST.
 
Methods inherited from Language::Visitor
#[], make_visit_method, #on_abstract_node, #visit, #visit_node
Constructor Details
#initialize(document, context) ⇒ BaseVisitor
Returns a new instance of BaseVisitor.
      5 6 7 8 9 10 11 12 13 14 15  | 
    
      # File 'lib/graphql/static_validation/base_visitor.rb', line 5 def initialize(document, context) @path = [] @object_types = [] @directives = [] @field_definitions = [] @argument_definitions = [] @directive_definitions = [] @context = context @schema = context.schema super(document) end  | 
  
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
      17 18 19  | 
    
      # File 'lib/graphql/static_validation/base_visitor.rb', line 17 def context @context end  | 
  
#object_types ⇒ Array<GraphQL::ObjectType> (readonly)
Returns Types whose scope we’ve entered.
      20 21 22  | 
    
      # File 'lib/graphql/static_validation/base_visitor.rb', line 20 def object_types @object_types end  | 
  
Class Method Details
.including_rules(rules) ⇒ Class
Build a class to visit the AST and perform validation,
or use a pre-built class if rules is ALL_RULES or empty.
      31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52  | 
    
      # File 'lib/graphql/static_validation/base_visitor.rb', line 31 def self.including_rules(rules) if rules.empty? # It's not doing _anything?!?_ BaseVisitor elsif rules == ALL_RULES InterpreterVisitor else visitor_class = Class.new(self) do include(GraphQL::StaticValidation::DefinitionDependencies) end rules.reverse_each do |r| # If it's a class, it gets attached later. if !r.is_a?(Class) visitor_class.include(r) end end visitor_class.include(ContextMethods) visitor_class end end  | 
  
Instance Method Details
#path ⇒ Array<String>
Returns The nesting of the current position in the AST.
      23 24 25  | 
    
      # File 'lib/graphql/static_validation/base_visitor.rb', line 23 def path @path.dup end  |