Class: Spandx::Os::Parsers::Apk

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

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)


7
8
9
# File 'lib/spandx/os/parsers/apk.rb', line 7

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

#parse(lockfile) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/spandx/os/parsers/apk.rb', line 11

def parse(lockfile)
  path = lockfile.to_s

  [].tap do |items|
    lockfile.open(mode: 'r') do |io|
      each_package(io) do |data|
        items.push(map_from(data, path))
      end
    end
  end
end