Class: Bundler::Audit::Results::UnpatchedGem
- Defined in:
- lib/bundler/audit/results/unpatched_gem.rb
Overview
Represents a gem version that has known vulnerabilities and needs to be upgraded.
Instance Attribute Summary collapse
-
#advisory ⇒ Advisory
readonly
The advisory documenting the vulnerability.
-
#gem ⇒ Gem::Specification
readonly
The specification of the vulnerable gem.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares the unpatched gem to another result.
-
#initialize(gem, advisory) ⇒ UnpatchedGem
constructor
Initializes the unpatched gem result.
-
#to_h ⇒ Hash{Symbol => Object}
Converts the unpatched gem to a Hash.
-
#to_s ⇒ String
Converts the unpatched gem result into a String.
Constructor Details
#initialize(gem, advisory) ⇒ UnpatchedGem
Initializes the unpatched gem result.
50 51 52 53 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 50 def initialize(gem,advisory) @gem = gem @advisory = advisory end |
Instance Attribute Details
#advisory ⇒ Advisory (readonly)
The advisory documenting the vulnerability.
39 40 41 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 39 def advisory @advisory end |
#gem ⇒ Gem::Specification (readonly)
The specification of the vulnerable gem.
34 35 36 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 34 def gem @gem end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the unpatched gem to another result.
62 63 64 65 66 67 68 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 62 def ==(other) self.class == other.class && ( @gem.name == other.gem.name && @gem.version == other.gem.version && @advisory == other.advisory ) end |
#to_h ⇒ Hash{Symbol => Object}
Converts the unpatched gem to a Hash.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 84 def to_h { type: :unpatched_gem, gem: { name: @gem.name, version: @gem.version }, advisory: @advisory.to_h } end |
#to_s ⇒ String
Converts the unpatched gem result into a String.
75 76 77 |
# File 'lib/bundler/audit/results/unpatched_gem.rb', line 75 def to_s @advisory.id end |