Class: Spandx::Os::Parsers::Dpkg

Inherits:
Core::Parser show all
Defined in:
lib/spandx/os/parsers/dpkg.rb

Defined Under Namespace

Classes: LineReader

Constant Summary

Constants inherited from Core::Parser

Core::Parser::UNKNOWN

Instance Method Summary collapse

Methods inherited from Core::Parser

for, parse

Methods included from Core::Registerable

#all, #each, #inherited, #registry

Instance Method Details

#match?(path) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/spandx/os/parsers/dpkg.rb', line 42

def match?(path)
  path.basename.fnmatch?('status')
end

#parse(lockfile) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/spandx/os/parsers/dpkg.rb', line 46

def parse(lockfile)
  [].tap do |items|
    lockfile.open(mode: 'r') do |io|
      LineReader.new(io).each do |data|
        items.push(map_from(data, lockfile.to_s))
      end
    end
  end
end