Class: Package::Audit::Ruby::VulnerabilityFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/package/audit/ruby/vulnerability_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ VulnerabilityFinder

Returns a new instance of VulnerabilityFinder.



8
9
10
11
# File 'lib/package/audit/ruby/vulnerability_finder.rb', line 8

def initialize(dir)
  @dir = dir
  @vuln_hash = {}
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
# File 'lib/package/audit/ruby/vulnerability_finder.rb', line 13

def run
  json_result = `#{format(Const::Cmd::BUNDLE_AUDIT_JSON, @dir)}`
  vulnerability_json_array = JSON.parse(json_result, symbolize_names: true)[:results]
  vulnerability_json_array.each do |vulnerability_json|
    (vulnerability_json)
  end
  @vuln_hash.values
end