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


77
78
79
80
# File 'lib/graphql/language/visitor.rb', line 77

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

Instance Attribute Details

#enterArray<Proc> (readonly)


73
74
75
# File 'lib/graphql/language/visitor.rb', line 73

def enter
  @enter
end

#leaveArray<Proc> (readonly)


75
76
77
# File 'lib/graphql/language/visitor.rb', line 75

def leave
  @leave
end

Instance Method Details

#<<(hook) ⇒ Object

Shorthand to add a hook to the #enter array


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

def <<(hook)
  enter << hook
end