Sha256: 882e27dc4b0f33a9b7de4adb59adc5f82d449aa5497bc464bfa8b1086f22b898
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Bolognese module Writers module CodemetaWriter def codemeta return nil unless valid? hsh = { "@context" => id.present? ? "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld" : nil, "@type" => types["schemaOrg"], "@id" => identifier, "identifier" => identifier, "codeRepository" => url, "title" => parse_attributes(titles, content: "title", first: true), "agents" => creator, "description" => parse_attributes(descriptions, content: "description", first: true), "version" => version_info, "tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil, "datePublished" => get_date(dates, "Issued"), "dateModified" => get_date(dates, "Updated"), "publisher" => publisher }.compact JSON.pretty_generate hsh.presence end end end end
Version data entries
4 entries across 4 versions & 1 rubygems