class Milestoner::Commits::Enrichers::Colleague
Enriches a commit colleague by using cache.
Public Class Methods
Source
# File lib/milestoner/commits/enrichers/colleague.rb, line 12 def initialize(key:, parser: Gitt::Parsers::Person.new, **) super(**) @key = key @parser = parser end
Calls superclass method
Public Instance Methods
Source
# File lib/milestoner/commits/enrichers/colleague.rb, line 18 def call(commit) = commit.find_trailers(key).bind { |trailers| users_for(trailers).compact } private attr_reader :key, :parser def users_for(trailers) = trailers.map { |trailer| user_for parser.call(trailer.value) } def user_for person cache.read(:users) { find person.name } .value_or(nil) end end end
Source
# File lib/milestoner/commits/enrichers/colleague.rb, line 26 def user_for person cache.read(:users) { find person.name } .value_or(nil) end
Source
# File lib/milestoner/commits/enrichers/colleague.rb, line 24 def users_for(trailers) = trailers.map { |trailer| user_for parser.call(trailer.value) } def user_for person cache.read(:users) { find person.name } .value_or(nil) end end