Class: Spoom::FileTree::CollectStrictnesses
- Defined in:
- lib/spoom/file_tree.rb
Overview
A visitor that collects the strictness of each node in a tree
Direct Known Subclasses
Instance Attribute Summary collapse
-
#strictnesses ⇒ Object
readonly
: Hash[Node, String?].
Instance Method Summary collapse
-
#initialize(context) ⇒ CollectStrictnesses
constructor
: (Context context) -> void.
-
#visit_node(node) ⇒ Object
: (FileTree::Node node) -> void.
Methods inherited from Visitor
Constructor Details
#initialize(context) ⇒ CollectStrictnesses
: (Context context) -> void
143 144 145 146 147 |
# File 'lib/spoom/file_tree.rb', line 143 def initialize(context) super() @context = context @strictnesses = T.let({}, T::Hash[Node, T.nilable(String)]) end |
Instance Attribute Details
#strictnesses ⇒ Object (readonly)
: Hash[Node, String?]
140 141 142 |
# File 'lib/spoom/file_tree.rb', line 140 def strictnesses @strictnesses end |
Instance Method Details
#visit_node(node) ⇒ Object
: (FileTree::Node node) -> void
151 152 153 154 155 156 |
# File 'lib/spoom/file_tree.rb', line 151 def visit_node(node) path = node.path @strictnesses[node] = @context.read_file_strictness(path) if @context.file?(path) super end |