Class: GraphQL::Language::Visitor::NodeVisitor
- Inherits:
- 
      Object
      
        - Object
- GraphQL::Language::Visitor::NodeVisitor
 
- Defined in:
- lib/graphql/language/visitor.rb
Overview
Collect enter and leave hooks for classes in Nodes
Access NodeVisitors via #[]
Instance Attribute Summary collapse
- 
  
    
      #enter  ⇒ Array<Proc> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Hooks to call when entering a node of this type. 
- 
  
    
      #leave  ⇒ Array<Proc> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Hooks to call when leaving a node of this type. 
Instance Method Summary collapse
- 
  
    
      #<<(hook)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Shorthand to add a hook to the #enter array. 
- 
  
    
      #initialize  ⇒ NodeVisitor 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of NodeVisitor. 
Constructor Details
#initialize ⇒ NodeVisitor
Returns a new instance of NodeVisitor.
| 229 230 231 232 | # File 'lib/graphql/language/visitor.rb', line 229 def initialize @enter = [] @leave = [] end | 
Instance Attribute Details
#enter ⇒ Array<Proc> (readonly)
Returns Hooks to call when entering a node of this type.
| 225 226 227 | # File 'lib/graphql/language/visitor.rb', line 225 def enter @enter end | 
#leave ⇒ Array<Proc> (readonly)
Returns Hooks to call when leaving a node of this type.
| 227 228 229 | # File 'lib/graphql/language/visitor.rb', line 227 def leave @leave end | 
Instance Method Details
#<<(hook) ⇒ Object
Shorthand to add a hook to the #enter array
| 236 237 238 | # File 'lib/graphql/language/visitor.rb', line 236 def <<(hook) enter << hook end |