Sha256: 3993604d82ed1cbd7fa575ca34de95b48cef662beee8bde62747f00c56aece2e

Contents?: true

Size: 872 Bytes

Versions: 27

Compression:

Stored size: 872 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" => parse_attributes(description, content: "text", first: true),
          "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

27 entries across 27 versions & 1 rubygems

Version Path
bolognese-0.10.21 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.20 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.19 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.18 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.17 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.16 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.15 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.14 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.13 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.11 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.10 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.9 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.8 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.7 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.6 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.5 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.4 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.3 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10.2 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.10 lib/bolognese/writers/codemeta_writer.rb