Sha256: 6512d386a83d6657de8362d144c0f75b94f6a3ca2ddeac9a18fc123d1a1c2f96

Contents?: true

Size: 903 Bytes

Versions: 24

Compression:

Stored size: 903 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" => 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

24 entries across 24 versions & 1 rubygems

Version Path
bolognese-0.15.9 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.15.8 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.15.6 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.15.3 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.15.1 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.14.1 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.14 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.13.6 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.13.4 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.13.3 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.13.2 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.13.1 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.12.3 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.12.2 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.12.1 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.12 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.11.7 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.11.6 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.11.5 lib/bolognese/writers/codemeta_writer.rb
bolognese-0.11.4 lib/bolognese/writers/codemeta_writer.rb