Sha256: 13aed8c13cf9caab6a921903aae29bf17ba3d0c48226a281488cf5a8c86df226

Contents?: true

Size: 679 Bytes

Versions: 10

Compression:

Stored size: 679 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[:input]

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

        def call commit
          commit.trailer_value_for(key)
                .value_or(input.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

10 entries across 10 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.10.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.9.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.6.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.5.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.4.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.3.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.2.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.1.0 lib/milestoner/commits/enrichers/note.rb
milestoner-17.0.0 lib/milestoner/commits/enrichers/note.rb