Class: Spoom::FileTree::CollectScores
- Inherits:
-
CollectStrictnesses
- Object
- Visitor
- CollectStrictnesses
- Spoom::FileTree::CollectScores
- 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
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.
162 163 164 165 166 |
# File 'lib/spoom/file_tree.rb', line 162 def initialize(context) super @context = context @scores = {} #: Hash[Node, Float] end |
Instance Attribute Details
#scores ⇒ Object (readonly)
159 160 161 |
# File 'lib/spoom/file_tree.rb', line 159 def scores @scores end |
Instance Method Details
#visit_node(node) ⇒ Object
170 171 172 173 174 |
# File 'lib/spoom/file_tree.rb', line 170 def visit_node(node) super @scores[node] = node_score(node) end |