Class: Package::Audit::Formatter::Risk

Inherits:
Base
  • Object
show all
Defined in:
lib/package/audit/formatter/risk.rb

Instance Method Summary collapse

Constructor Details

#initialize(risk_type) ⇒ Risk

Returns a new instance of Risk.



8
9
10
11
# File 'lib/package/audit/formatter/risk.rb', line 8

def initialize(risk_type)
  super()
  @risk_type = risk_type
end

Instance Method Details

#formatObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/package/audit/formatter/risk.rb', line 13

def format
  case @risk_type
  when Enum::RiskType::HIGH
    Util::BashColor.red(Enum::RiskType::HIGH)
  when Enum::RiskType::MEDIUM
    Util::BashColor.orange(Enum::RiskType::MEDIUM)
  when Enum::RiskType::LOW
    Util::BashColor.yellow(Enum::RiskType::LOW)
  else
    @risk_type.to_s
  end
end