Sha256: 4d1764aebc457aa9ae4753367c355aa8bb848c78c5223d4124e12582687963cd

Contents?: true

Size: 567 Bytes

Versions: 3

Compression:

Stored size: 567 Bytes

Contents

module Datasets
  class License < Struct.new(:spdx_id,
                             :name,
                             :url)
    class << self
      def try_convert(value)
        case value
        when self
          value
        when String
          license = new
          license.spdx_id = value
          license
        when Hash
          license = new
          license.spdx_id = value[:spdx_id]
          license.name = value[:name]
          license.url = value[:url]
          license
        else
          nil
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
red-datasets-0.1.7 lib/datasets/license.rb
red-datasets-0.1.6 lib/datasets/license.rb
red-datasets-0.1.5 lib/datasets/license.rb