Class: Spandx::Core::Parser
- Inherits:
-
Object
- Object
- Spandx::Core::Parser
show all
- Extended by:
- Registerable
- Defined in:
- lib/spandx/core/parser.rb
Direct Known Subclasses
Dotnet::Parsers::Csproj, Dotnet::Parsers::PackagesConfig, Dotnet::Parsers::Sln, Java::Parsers::Maven, Js::Parsers::Npm, Js::Parsers::Yarn, Os::Parsers::Apk, Os::Parsers::Dpkg, Php::Parsers::Composer, Python::Parsers::PipfileLock, Ruby::Parsers::GemfileLock, Terraform::Parsers::LockFile
Constant Summary
collapse
- UNKNOWN =
Class.new do
def self.parse(*_args)
[]
end
end
Class Method Summary
collapse
Instance Method Summary
collapse
all, each, inherited, registry
Class Method Details
.for(path) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/spandx/core/parser.rb', line 27
def for(path)
path = Pathname.new(path)
return UNKNOWN if !path.exist? || path.zero?
find { |x| x.match?(path) } || UNKNOWN
end
|
.parse(path) ⇒ Object
23
24
25
|
# File 'lib/spandx/core/parser.rb', line 23
def parse(path)
self.for(path).parse(path)
end
|
Instance Method Details
#match?(_path) ⇒ Boolean
12
13
14
|
# File 'lib/spandx/core/parser.rb', line 12
def match?(_path)
raise ::Spandx::Error, :match?
end
|
#parse(_dependency) ⇒ Object
16
17
18
|
# File 'lib/spandx/core/parser.rb', line 16
def parse(_dependency)
raise ::Spandx::Error, :parse
end
|