Class: Spandx::Core::Parser

Inherits:
Object
  • Object
show all
Extended by:
Registerable
Defined in:
lib/spandx/core/parser.rb

Constant Summary collapse

UNKNOWN =
Class.new do
  def self.parse(*_args)
    []
  end
end

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Registerable

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

Returns:

  • (Boolean)

Raises:



12
13
14
# File 'lib/spandx/core/parser.rb', line 12

def match?(_path)
  raise ::Spandx::Error, :match?
end

#parse(_dependency) ⇒ Object

Raises:



16
17
18
# File 'lib/spandx/core/parser.rb', line 16

def parse(_dependency)
  raise ::Spandx::Error, :parse
end