Class: Spoom::FileTree::CollectScores

Inherits:
CollectStrictnesses show all
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

Attributes inherited from CollectStrictnesses

#strictnesses

Instance Method Summary collapse

Methods inherited from Visitor

#visit_nodes, #visit_tree

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

#scoresObject (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