Class: GraphQL::Language::Visitor::NodeVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/language/visitor.rb

Overview

Collect ‘enter` and `leave` hooks for classes in Nodes

Access NodeVisitors via #[]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNodeVisitor



85
86
87
88
# File 'lib/graphql/language/visitor.rb', line 85

def initialize
  @enter = []
  @leave = []
end

Instance Attribute Details

#enterArray<Proc> (readonly)



81
82
83
# File 'lib/graphql/language/visitor.rb', line 81

def enter
  @enter
end

#leaveArray<Proc> (readonly)



83
84
85
# File 'lib/graphql/language/visitor.rb', line 83

def leave
  @leave
end

Instance Method Details

#<<(hook) ⇒ Object

Shorthand to add a hook to the #enter array



92
93
94
# File 'lib/graphql/language/visitor.rb', line 92

def <<(hook)
  enter << hook
end