Sha256: c577a1c6a3e552064c7dc78f9cf8270e2bced76b38768d25139ee62ddd54036a

Contents?: true

Size: 709 Bytes

Versions: 13

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, **)
          @key = key
          @model = model
          super(**)
        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

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-18.11.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.10.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.9.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.8.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.7.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.6.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.5.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.4.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.3.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.2.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.1.0 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.0.1 lib/milestoner/commits/enrichers/issue.rb
milestoner-18.0.0 lib/milestoner/commits/enrichers/issue.rb