Sha256: c93ee2d8bc70e69ea025a5375ad8518f6c0d15df7fd4e92447dda49ec2772df7

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module Spandx
  module Spdx
    class License
      attr_reader :attributes

      def initialize(attributes = {})
        @attributes = attributes
      end

      def id
        attributes[:licenseId]
      end

      def id=(value)
        attributes[:licenseId] = value
      end

      def name
        attributes[:name]
      end

      def name=(value)
        attributes[:name] = value
      end

      def reference
        attributes[:reference]
      end

      def reference=(value)
        attributes[:reference] = value
      end

      def deprecated_license_id?
        attributes[:isDeprecatedLicenseId]
      end

      def url
        attributes[:detailsUrl]
      end

      def url=(value)
        attributes[:detailsUrl] = value
      end

      def osi_approved?
        attributes[:isOsiApproved]
      end

      def see_also
        attributes[:seeAlso]
      end

      def reference_number
        attributes[:referenceNumber]
      end

      def reference_number=(value)
        attributes[:referenceNumber] = value
      end

      def content
        @content ||= ::Spandx::Core::Content.new(raw_content)
      end

      def raw_content
        @raw_content ||= (Spandx.spdx_db.read("text/#{id}.txt") || '')
      end

      def <=>(other)
        id <=> other.id
      end

      def to_s
        id
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spandx-0.11.0 lib/spandx/spdx/license.rb
spandx-0.10.1 lib/spandx/spdx/license.rb
spandx-0.10.0 lib/spandx/spdx/license.rb
spandx-0.9.0 lib/spandx/spdx/license.rb
spandx-0.8.0 lib/spandx/spdx/license.rb
spandx-0.7.0 lib/spandx/spdx/license.rb
spandx-0.6.0 lib/spandx/spdx/license.rb