Sha256: c6a886febb3bc15d6b9da4b4e2899263d783910855d8dcb9edc131f3aefb24ee
Contents?: true
Size: 849 Bytes
Versions: 2
Compression:
Stored size: 849 Bytes
Contents
# frozen_string_literal: true module Spandx module Core class Parser UNKNOWN = Class.new do def self.parse(*_args) [] end end attr_reader :catalogue def initialize(catalogue:) @catalogue = catalogue end class << self include Enumerable def each(&block) registry.each do |x| block.call(x) end end def inherited(subclass) registry.push(subclass) end def registry @registry ||= [] end def for(path, catalogue: Spandx::Spdx::Catalogue.from_git) result = ::Spandx::Core::Parser.find do |x| x.matches?(File.basename(path)) end result&.new(catalogue: catalogue) || UNKNOWN end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spandx-0.7.0 | lib/spandx/core/parser.rb |
spandx-0.6.0 | lib/spandx/core/parser.rb |