Sha256: c1483004f7a2ca636db56c35f174ddceb92ef8489512f3863dc088458f09494d

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 Bytes

Contents

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" => type,
          "@id" => identifier,
          "identifier" => identifier,
          "codeRepository" => b_url,
          "title" => title,
          "agents" => author,
          "description" => description.present? ? description["text"] : nil,
          "version" => b_version,
          "tags" => keywords.to_s.split(", ").presence,
          "dateCreated" => date_created,
          "datePublished" => date_published,
          "dateModified" => date_modified,
          "publisher" => publisher
        }.compact
        JSON.pretty_generate hsh.presence
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bolognese-0.9.92 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.9.91 lib/bolognese/writers/codemeta_writer.rb