Class: InciScore::Scorer
- Inherits:
-
Object
- Object
- InciScore::Scorer
- Defined in:
- lib/inci_score/scorer.rb
Constant Summary collapse
- HAZARD_PERCENT =
25
- WEIGHT_FACTOR =
5
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(hazards) ⇒ Scorer
constructor
A new instance of Scorer.
Constructor Details
#initialize(hazards) ⇒ Scorer
Returns a new instance of Scorer.
8 9 10 11 |
# File 'lib/inci_score/scorer.rb', line 8 def initialize(hazards) @hazards = Array(hazards) @size = @hazards.size end |
Instance Method Details
#call ⇒ Object
13 14 15 16 |
# File 'lib/inci_score/scorer.rb', line 13 def call return 0 if @hazards.empty? (100 - avg * HAZARD_PERCENT).round(4) end |