class DataKitten::License

A license for a {Dataset} or {Distribution}

Constants

LICENSES

Attributes

abbr[RW]

@!attribute abbr

@return [String] the license abbreviation
id[RW]

@!attribute is

@return [String] a short ID that identifies the license.
name[RW]

@!attribute name

@return [String] the human name of the license.
type[RW]

@!attribute type

@return [String] the type of information this license applies to. Could be +:data+ or +:content+.
uri[RW]

@!attribute uri

@return [String] the URI for the license text.

Public Class Methods

new(options) click to toggle source

Create a new License object.

@param options [Hash] A set of options with which to initialise the license. @option options [String] :id the short ID for the license @option options [String] :name the human name for the license @option options [String] :uri the URI of the license text @option options [String] :type the type of information covered by this license.

# File lib/data_kitten/license.rb, line 51
def initialize(options)
  @id = options[:id]
  @name = options[:name]
  @uri = options[:uri]
  @type = options[:type]
  @abbr = get_license_abbr(@uri) if @uri
end

Public Instance Methods

get_license_abbr(uri) click to toggle source
# File lib/data_kitten/license.rb, line 59
def get_license_abbr(uri)
  license = LICENSES.find { |regex, abbr| uri =~ regex }
  license.last if license
end