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.
151 152 153 154 155 |
# File 'lib/spoom/file_tree.rb', line 151 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.
148 149 150 |
# File 'lib/spoom/file_tree.rb', line 148 def strictnesses @strictnesses end |
Instance Method Details
#visit_node(node) ⇒ Object
158 159 160 161 162 163 |
# File 'lib/spoom/file_tree.rb', line 158 def visit_node(node) path = node.path @strictnesses[node] = @context.read_file_strictness(path) if @context.file?(path) super end |