Class: Spoom::FileTree::CollectStrictnesses
- Extended by:
- T::Sig
- 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
Returns the value of attribute strictnesses.
Instance Method Summary collapse
-
#initialize(context) ⇒ CollectStrictnesses
constructor
A new instance of CollectStrictnesses.
- #visit_node(node) ⇒ Object
Methods inherited from Visitor
Constructor Details
#initialize(context) ⇒ CollectStrictnesses
Returns a new instance of CollectStrictnesses.
167 168 169 170 171 |
# File 'lib/spoom/file_tree.rb', line 167 def initialize(context) super() @context = context @strictnesses = T.let({}, T::Hash[Node, T.nilable(String)]) end |
Instance Attribute Details
#strictnesses ⇒ Object (readonly)
Returns the value of attribute strictnesses.
164 165 166 |
# File 'lib/spoom/file_tree.rb', line 164 def strictnesses @strictnesses end |
Instance Method Details
#visit_node(node) ⇒ Object
174 175 176 177 178 179 |
# File 'lib/spoom/file_tree.rb', line 174 def visit_node(node) path = node.path @strictnesses[node] = @context.read_file_strictness(path) if @context.file?(path) super end |