Sha256: a34fd08169813b79b774fb56ec062e6afe5e3d2575849fb448db6170b09902ae
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 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, :created_at, :format, :issue, :milestone, :notes, :review, :signers, :updated_at, :uri ] include Dry::Monads[:result] def initialize(categorizer: Commits::Categorizer.new, model: Models::Commit, **) super(**) @categorizer = categorizer @model = model 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
milestoner-18.12.0 | lib/milestoner/commits/enricher.rb |