Sha256: 8d721f9640ab7352f62cf73a5a951eccd52f452bda88ab00fc6cf8f37b262fc3

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module Spandx
  class Report
    def initialize(report: { version: '1.0', packages: [] })
      @report = report
    end

    def add(name:, version:, licenses: [])
      @report[:packages].push(
        name: name,
        version: version,
        licenses: licenses.map(&:id)
      )
    end

    def to_h
      @report
    end

    def to_json(*_args)
      JSON.pretty_generate(to_h)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spandx-0.1.3 lib/spandx/report.rb
spandx-0.1.2 lib/spandx/report.rb