Sha256: 9ea0e2094269a8d768f57a2acf3da4c08aba3c46d9cd3f5b9c7ccd895eecff67
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Bolognese module Writers module CodemetaWriter def codemeta return nil unless valid? || show_errors hsh = { "@context" => id.present? ? "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld" : nil, "@type" => types["schemaOrg"], "@id" => normalize_doi(doi), "identifier" => to_schema_org_identifiers(identifiers), "codeRepository" => url, "name" => parse_attributes(titles, content: "title", first: true), "authors" => creators, "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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bolognese-1.3.22 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.3.21 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.3.20 | lib/bolognese/writers/codemeta_writer.rb |