Class: Spoom::FileTree::CollectScores
- Inherits:
-
CollectStrictnesses
- Object
- Visitor
- CollectStrictnesses
- Spoom::FileTree::CollectScores
- Extended by:
- T::Sig
- Defined in:
- lib/spoom/file_tree.rb
Overview
A visitor that collects the typing score of each node in a tree
Instance Attribute Summary collapse
-
#scores ⇒ Object
readonly
Returns the value of attribute scores.
Attributes inherited from CollectStrictnesses
Instance Method Summary collapse
-
#initialize(context) ⇒ CollectScores
constructor
A new instance of CollectScores.
- #visit_node(node) ⇒ Object
Methods inherited from Visitor
Constructor Details
#initialize(context) ⇒ CollectScores
Returns a new instance of CollectScores.
190 191 192 193 194 |
# File 'lib/spoom/file_tree.rb', line 190 def initialize(context) super @context = context @scores = T.let({}, T::Hash[Node, Float]) end |
Instance Attribute Details
#scores ⇒ Object (readonly)
Returns the value of attribute scores.
187 188 189 |
# File 'lib/spoom/file_tree.rb', line 187 def scores @scores end |
Instance Method Details
#visit_node(node) ⇒ Object
197 198 199 200 201 |
# File 'lib/spoom/file_tree.rb', line 197 def visit_node(node) super @scores[node] = node_score(node) end |