Class: Jazzy::SymbolGraph::BaseNode

Inherits:
Object
  • Object
show all
Defined in:
lib/jazzy/symbol_graph/sym_node.rb

Overview

The rebuilt syntax tree is made of nodes that either match symbols or that we fabricate for extensions. This is the common treeishness.

Direct Known Subclasses

ExtNode, SymNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseNode

Returns a new instance of BaseNode.



12
13
14
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 12

def initialize
  self.children = []
end

Instance Attribute Details

#childrenObject

array, can be empty



9
10
11
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 9

def children
  @children
end

#parentObject

can be nil



10
11
12
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 10

def parent
  @parent
end

Instance Method Details

#add_child(child) ⇒ Object



16
17
18
19
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 16

def add_child(child)
  child.parent = self
  children.append(child)
end

#children_to_sourcekitObject



21
22
23
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 21

def children_to_sourcekit
  children.sort.map(&:to_sourcekit)
end