Class: Milestoner::Commits::Enrichers::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/milestoner/commits/enrichers/issue.rb

Overview

Enriches a commit issue based on trailer information.

Instance Method Summary collapse

Constructor Details

#initialize(key: "Issue", model: Models::Link) ⇒ Issue

Returns a new instance of Issue.



10
11
12
13
14
# File 'lib/milestoner/commits/enrichers/issue.rb', line 10

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

Instance Method Details

#call(commit) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/milestoner/commits/enrichers/issue.rb', line 16

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