Sha256: 75acb6dfe7731b793cf1352cf8e94a013bb5114d208305973a0db60eefa43cd9
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 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 |command, attributes| attributes[command] = __send__(command).call commit end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems