Sha256: 4bbc441d40215e0a1414c84dd4faa443c95dacb0f2d25cd3631015261bd97c55

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Spandx
  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 ||= Content.new(Spandx.db.read("text/#{id}.txt"))
    end

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

    def to_s
      id
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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