Sha256: 6a4403d8d0352e5606ab950ccf22a87c6837565273e9b4bbc3202bc1378f0b05
Contents?: true
Size: 940 Bytes
Versions: 3
Compression:
Stored size: 940 Bytes
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["type"], "@id" => identifier, "identifier" => identifier, "codeRepository" => url, "title" => parse_attributes(title, content: "text", first: true), "agents" => creator, "description" => parse_attributes(description, content: "text", first: true), "version" => version, "tags" => keywords.to_s.split(", ").presence, "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.6 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.0.5 | lib/bolognese/writers/codemeta_writer.rb |
bolognese-1.0.4 | lib/bolognese/writers/codemeta_writer.rb |