Sha256: 65e22b863b567209789a2384c4800ad25aee6ad22329aeefd04e9a41e68c36c3

Contents?: true

Size: 774 Bytes

Versions: 3

Compression:

Stored size: 774 Bytes

Contents

require_relative "license"

module Datasets
  class Metadata < Struct.new(:id,
                              :name,
                              :url,
                              :licenses,
                              :description)
    def licenses=(licenses)
      licenses = [licenses] unless licenses.is_a?(Array)
      licenses = licenses.collect do |license|
        l = License.try_convert(license)
        if l.nil?
          raise ArgumentError.new("invalid license: #{license.inspect}")
        end
        l
      end
      super(licenses)
    end

    def description
      description_raw = super
      if description_raw.respond_to?(:call)
        self.description = description_raw = description_raw.call
      end
      description_raw
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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