Sha256: a4a58da031477fce4b7078e8ad7361b3fd9cc426fec7ca2d3b768d2bf16ce28f

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 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, **)
          super(**)
          @model = model
        end

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

        private

        attr_reader :model
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-18.12.0 lib/milestoner/commits/enrichers/author.rb