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.
147 148 149 150 |
# File 'lib/spoom/file_tree.rb', line 147 def initialize super() @nodes = T.let([], T::Array[FileTree::Node]) end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
144 145 146 |
# File 'lib/spoom/file_tree.rb', line 144 def nodes @nodes end |
Instance Method Details
#visit_node(node) ⇒ Object
153 154 155 156 |
# File 'lib/spoom/file_tree.rb', line 153 def visit_node(node) @nodes << node super end |