Class: Spandx::Java::Parsers::Maven

Inherits:
Core::Parser show all
Defined in:
lib/spandx/java/parsers/maven.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/java/parsers/maven.rb', line 7

def match?(path)
  path.basename.fnmatch?('pom.xml')
end

#parse(path) ⇒ Object



11
12
13
14
15
16
# File 'lib/spandx/java/parsers/maven.rb', line 11

def parse(path)
  document = Nokogiri.XML(path.read).tap(&:remove_namespaces!)
  document.search('//project/dependencies/dependency').map do |node|
    map_from(path, node)
  end
end