Class: Spoom::FileTree::CollectNodes
- Extended by:
- T::Sig
- Defined in:
- lib/spoom/file_tree.rb
Overview
A visitor that collects all the nodes in a tree
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#initialize ⇒ CollectNodes
constructor
A new instance of CollectNodes.
- #visit_node(node) ⇒ Object
Methods inherited from Visitor
Constructor Details
#initialize ⇒ CollectNodes
Returns a new instance of CollectNodes.
131 132 133 134 |
# File 'lib/spoom/file_tree.rb', line 131 def initialize super() @nodes = T.let([], T::Array[FileTree::Node]) end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
128 129 130 |
# File 'lib/spoom/file_tree.rb', line 128 def nodes @nodes end |
Instance Method Details
#visit_node(node) ⇒ Object
137 138 139 140 |
# File 'lib/spoom/file_tree.rb', line 137 def visit_node(node) @nodes << node super end |