Sha256: 55c70c00bacfa69253711615602c2b07dbacad19acf406a17b2b76d469ed6a58
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Unwrappr module Writers # Add links to project documentation as obtained from Rubygems.org. # Specifically, the changelog and sourcecode. # # Implements the `annotation_writer` interface required by the # LockFileAnnotator. class ProjectLinks def self.write(gem_change, gem_change_info) new(gem_change, gem_change_info).write end def initialize(gem_change, gem_change_info) @gem_change = gem_change @gem_change_info = gem_change_info end def write "[_#{change_log}, #{source_code}_]\n" end private def change_log link_or_strikethrough('change-log', @gem_change_info[:ruby_gems]&.changelog_uri) end def source_code link_or_strikethrough('source-code', @gem_change_info[:ruby_gems]&.source_code_uri) end def link_or_strikethrough(text, url) if url.nil? || url.empty? "~~#{text}~~" else "[#{text}](#{url})" end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems