Sha256: 1eed384200b636fba83f59e1f7c7b296ca134889254ef986989635733c108864

Contents?: true

Size: 523 Bytes

Versions: 7

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module Commits
    module Enrichers
      # Enriches a commit author by using cache.
      class Author
        include Milestoner::Import[:cache]

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

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

        private

        attr_reader :model
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
milestoner-17.6.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.5.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.4.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.3.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.2.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.1.0 lib/milestoner/commits/enrichers/author.rb
milestoner-17.0.0 lib/milestoner/commits/enrichers/author.rb