Sha256: 43bd89ec1ec86218760eadfb39b08f1681854b31deff9fea3bfbbcd7beae511f
Contents?: true
Size: 1.1 KB
Versions: 8
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require "dry/monads" module Milestoner module Commits # Enriches commits and associated trailers for final processing. class Enricher include Import[:settings] include Enrichers::Import[ :author, :body, :collaborators, :format, :issue, :milestone, :notes, :review, :signers, :uri ] include Dry::Monads[:result] def initialize(categorizer: Commits::Categorizer.new, model: Models::Commit, **) @categorizer = categorizer @model = model super(**) end def call min: Collector::MIN, max: Collector::MAX categorizer.call(min:, max:) .map { |commit| model.for(commit, **build_attributes(commit)) } .then { |commits| Success commits } end private attr_reader :categorizer, :model def build_attributes commit infused_keys.each.with_object({}) do |key, attributes| attributes[key] = __send__(key).call commit end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems