Class: Jazzy::SymbolGraph::BaseNode
- Inherits:
-
Object
- Object
- Jazzy::SymbolGraph::BaseNode
- 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.
Instance Attribute Summary collapse
-
#children ⇒ Object
array, can be empty.
-
#parent ⇒ Object
can be nil.
Instance Method Summary collapse
- #add_child(child) ⇒ Object
- #children_to_sourcekit ⇒ Object
-
#initialize ⇒ BaseNode
constructor
A new instance of BaseNode.
Constructor Details
#initialize ⇒ BaseNode
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
#children ⇒ Object
array, can be empty
9 10 11 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 9 def children @children end |
#parent ⇒ Object
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_sourcekit ⇒ Object
21 22 23 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 21 def children_to_sourcekit children.sort.map(&:to_sourcekit) end |