Sha256: f2f17610f0a1d3f279287edf8aa4411b3691af1a898a9195cb59bed5dea179e4
Contents?: true
Size: 677 Bytes
Versions: 2
Compression:
Stored size: 677 Bytes
Contents
# frozen_string_literal: true module Spandx class Catalogue include Enumerable def initialize(catalogue = {}) @catalogue = catalogue end def version catalogue[:licenseListVersion] end def each licenses.each do |license| yield license if present?(license.id) end end def self.latest CatalogueGateway.new.fetch end private attr_reader :catalogue def licenses @licenses ||= catalogue.fetch(:licenses, []).map { |x| map_from(x) } end def map_from(license_hash) License.new(license_hash) end def present?(item) item && !item.empty? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spandx-0.1.1 | lib/spandx/catalogue.rb |
spandx-0.1.0 | lib/spandx/catalogue.rb |