Class: GraphQL::Visitor::NodeVisitor
- Inherits:
-
Object
- Object
- GraphQL::Visitor::NodeVisitor
- Defined in:
- lib/graph_ql/parser/visitor.rb
Instance Attribute Summary collapse
-
#enter ⇒ Object
readonly
Returns the value of attribute enter.
-
#leave ⇒ Object
readonly
Returns the value of attribute leave.
Instance Method Summary collapse
- #<<(hook) ⇒ Object
- #begin_visit(node) ⇒ Object
- #end_visit(node) ⇒ Object
-
#initialize ⇒ NodeVisitor
constructor
A new instance of NodeVisitor.
Constructor Details
#initialize ⇒ NodeVisitor
Returns a new instance of NodeVisitor.
30 31 32 33 |
# File 'lib/graph_ql/parser/visitor.rb', line 30 def initialize @enter = [] @leave = [] end |
Instance Attribute Details
#enter ⇒ Object (readonly)
Returns the value of attribute enter.
29 30 31 |
# File 'lib/graph_ql/parser/visitor.rb', line 29 def enter @enter end |
#leave ⇒ Object (readonly)
Returns the value of attribute leave.
29 30 31 |
# File 'lib/graph_ql/parser/visitor.rb', line 29 def leave @leave end |
Instance Method Details
#<<(hook) ⇒ Object
35 36 37 |
# File 'lib/graph_ql/parser/visitor.rb', line 35 def <<(hook) enter << hook end |
#begin_visit(node) ⇒ Object
39 40 41 |
# File 'lib/graph_ql/parser/visitor.rb', line 39 def begin_visit(node) enter.map{ |proc| proc.call(node) } end |
#end_visit(node) ⇒ Object
43 44 45 |
# File 'lib/graph_ql/parser/visitor.rb', line 43 def end_visit(node) leave.map{ |proc| proc.call(node) } end |