Sha256: e3eb20b671cb5d75e62b5216c80981ead0ebbe1444da7db69fcb66a2f6e74b0d

Contents?: true

Size: 768 Bytes

Versions: 11

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module Unwrappr
  module Writers
    # Add the gem name to the annotation as a heading. If a homepage
    # URI has been determined this heading will link to that page.
    #
    # Implements the `annotation_writer` interface required by the
    # LockFileAnnotator.
    module Title
      class << self
        def write(gem_change, gem_change_info)
          embellished_gem_name = maybe_link(
            gem_change.name,
            gem_change_info[:ruby_gems]&.homepage_uri
          )
          "### #{embellished_gem_name}\n"
        end

        private

        def maybe_link(text, url)
          if url.nil?
            text
          else
            "[#{text}](#{url})"
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unwrappr-0.8.0 lib/unwrappr/writers/title.rb
unwrappr-0.7.0 lib/unwrappr/writers/title.rb
unwrappr-0.6.0 lib/unwrappr/writers/title.rb
unwrappr-0.5.0 lib/unwrappr/writers/title.rb
unwrappr-0.4.0 lib/unwrappr/writers/title.rb
unwrappr-0.3.5 lib/unwrappr/writers/title.rb
unwrappr-0.3.4 lib/unwrappr/writers/title.rb
unwrappr-0.3.3 lib/unwrappr/writers/title.rb
unwrappr-0.3.2 lib/unwrappr/writers/title.rb
unwrappr-0.3.1 lib/unwrappr/writers/title.rb
unwrappr-0.3.0 lib/unwrappr/writers/title.rb