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.
10 11 12 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 10 def initialize self.children = [] end |
Instance Attribute Details
#children ⇒ Object
array, can be empty
7 8 9 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 7 def children @children end |
#parent ⇒ Object
can be nil
8 9 10 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 8 def parent @parent end |
Instance Method Details
#add_child(child) ⇒ Object
14 15 16 17 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 14 def add_child(child) child.parent = self children.append(child) end |
#children_to_sourcekit ⇒ Object
19 20 21 |
# File 'lib/jazzy/symbol_graph/sym_node.rb', line 19 def children_to_sourcekit children.sort.map(&:to_sourcekit) end |