Class: Package::Audit::RiskCalculator
- Inherits:
-
Object
- Object
- Package::Audit::RiskCalculator
- Defined in:
- lib/package/audit/services/risk_calculator.rb
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(pkg) ⇒ RiskCalculator
constructor
A new instance of RiskCalculator.
Constructor Details
#initialize(pkg) ⇒ RiskCalculator
Returns a new instance of RiskCalculator.
9 10 11 |
# File 'lib/package/audit/services/risk_calculator.rb', line 9 def initialize(pkg) @pkg = pkg end |
Instance Method Details
#find ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/package/audit/services/risk_calculator.rb', line 13 def find risks = assess_vulnerability_risks + assess_deprecation_risks + assess_version_risks unless production_dependency? risks.each_with_index do |risk, index| risks[index] = [risk, Risk.new(Enum::RiskType::LOW, risk.explanation)].min || Risk.new(Enum::RiskType::NONE) end end risks end |