Class: Milestoner::Commits::Enrichers::Author

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

Overview

Enriches a commit author by using cache.

Instance Method Summary collapse

Constructor Details

#initialize(model: Models::User) ⇒ Author

Returns a new instance of Author.



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

def initialize(model: Models::User, **)
  super(**)
  @model = model
end

Instance Method Details

#call(commit) ⇒ Object



15
16
17
18
# File 'lib/milestoner/commits/enrichers/author.rb', line 15

def call commit
  cache.read(:users) { |table| table.find commit.author_name }
       .value_or(model.new)
end