Sha256: 813be9fe4fe582705af63c6d01b1958249e1773d510c584ae40c9c93d9d47d2a

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

require 'spandx/parsers/base'
require 'spandx/parsers/csproj'
require 'spandx/parsers/gemfile_lock'
require 'spandx/parsers/packages_config'
require 'spandx/parsers/pipfile_lock'

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

    class << self
      def for(path, catalogue: Spandx::Catalogue.from_git)
        result = ::Spandx::Parsers::Base.find do |x|
          x.matches?(File.basename(path))
        end

        result&.new(catalogue: catalogue) || UNKNOWN
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spandx-0.1.7 lib/spandx/parsers.rb
spandx-0.1.6 lib/spandx/parsers.rb