Class: GemFresh::Calculator
- Inherits:
-
Object
- Object
- GemFresh::Calculator
- Defined in:
- lib/gem_fresh/calculator.rb
Constant Summary collapse
- POINTS_FOR_MAJOR =
If a gem is behind by a major version, it’s worth more points than a minor version.
100- POINTS_FOR_MINOR =
10- POINTS_FOR_PATCH =
1- MINIMAL_MULTIPLIER =
Point multipliers based on how central the gem is to the application code.
0.1- LOCAL_MULTIPLIER =
1- SYSTEM_MULTIPLIER =
10- FRAMEWORK_MULTIPLIER =
100
Instance Method Summary collapse
- #all_scores ⇒ Object
- #calculate! ⇒ Object
-
#initialize ⇒ Calculator
constructor
A new instance of Calculator.
- #total_score ⇒ Object
Constructor Details
#initialize ⇒ Calculator
Returns a new instance of Calculator.
16 17 18 |
# File 'lib/gem_fresh/calculator.rb', line 16 def initialize @freshness_scores = {} end |
Instance Method Details
#all_scores ⇒ Object
29 30 31 |
# File 'lib/gem_fresh/calculator.rb', line 29 def all_scores @freshness_scores end |
#calculate! ⇒ Object
20 21 22 23 |
# File 'lib/gem_fresh/calculator.rb', line 20 def calculate! @gem_freshness_info = GemFresh::Outdated.new.gem_info calculate_freshness_scores_for_each_gem end |
#total_score ⇒ Object
25 26 27 |
# File 'lib/gem_fresh/calculator.rb', line 25 def total_score @freshness_scores.values.sum.round(1) end |