module SpdxLicenses

Constants

VERSION

Public Class Methods

[](id)
Alias for: lookup
data() click to toggle source
# File lib/spdx-licenses.rb, line 6
def self.data
  unless defined?(@@data)
    spdx = JSON.load(File.read(File.expand_path('../../licenses.json', __FILE__)))

    # Convert the array of hashes to a hash with the license ID as the key and
    # the rest of each hash as the value.
    @@data = {}
    spdx['licenses'].each do |details|
      id = details.delete('licenseId')
      @@data[id] = details
    end
  end

  @@data
end
exist?(id) click to toggle source
# File lib/spdx-licenses.rb, line 27
def self.exist?(id)
  data.has_key? id.to_s
end
Also aliased as: exists?
exists?(id)
Alias for: exist?
lookup(id) click to toggle source
# File lib/spdx-licenses.rb, line 22
def self.lookup(id)
  entry = data[id.to_s]
  SpdxLicenses::License.new(id.to_s, entry['name'], entry['isOsiApproved']) if entry
end
Also aliased as: []
version() click to toggle source
# File lib/spdx-licenses.rb, line 31
def self.version
  VERSION
end