Sha256: c8b49fa67e310893cc14a98e10f5d1b0a0bff9ceed79db23f327ab86012744a8

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module Commits
    module Enrichers
      # Enriches commit notes by rendering as HTML based on trailer information.
      class Note
        include Milestoner::Import[:settings]

        def initialize(key: "Format", renderer: Renderers::Universal.new, **)
          super(**)
          @key = key
          @renderer = renderer
        end

        def call commit
          commit.trailer_value_for(key)
                .value_or(settings.commit_format)
                .then { |format| renderer.call commit.notes, for: format.to_sym }
        end

        private

        attr_reader :key, :renderer
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-18.12.0 lib/milestoner/commits/enrichers/note.rb