Sha256: 9e92772ba4e8d60033a353d9d88204fb14c5273d2ab52e984359f12fa3e4e2e9
Contents?: true
Size: 1.01 KB
Versions: 3
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" => 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.0.29 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.0.28 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.0.27 | lib/bolognese/writers/codemeta_writer.rb |