Class: CodeKeeper::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/code_keeper/result.rb

Overview

Store results of each score.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



8
9
10
# File 'lib/code_keeper/result.rb', line 8

def initialize
  @scores = CodeKeeper.config.metrics.map { |key| [key, {}] }.to_h
end

Instance Attribute Details

#scoresObject (readonly)

Returns the value of attribute scores.



6
7
8
# File 'lib/code_keeper/result.rb', line 6

def scores
  @scores
end

Instance Method Details

#add(metric, klass_or_path, score) ⇒ Object



12
13
14
# File 'lib/code_keeper/result.rb', line 12

def add(metric, klass_or_path, score)
  scores[:"#{metric}"].store(klass_or_path, score)
end