Sha256: c706265b39914793f26e43e378aee5badf8ee39a7d4aa318686de2f5f5ca405f

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module Commits
    module Enrichers
      # Enriches a commit issue based on trailer information.
      class Issue
        include Milestoner::Import[:settings]

        def initialize(key: "Issue", model: Models::Link, **)
          super(**)
          @key = key
          @model = model
        end

        def call commit
          uri = settings.tracker_uri

          commit.trailer_value_for(key)
                .either -> value { model[id: value, uri: format(uri, id: value)] },
                        proc { model[id: "All", uri: format(uri, id: nil)] }
        end

        private

        attr_reader :key, :model
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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