Sha256: 1d6a7b0f13ad4b2f0dabc96e3b600bc6c70d1a532cdef10ba833d84299033167
Contents?: true
Size: 1.1 KB
Versions: 3
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[:input] 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
milestoner-17.11.0 | lib/milestoner/commits/enricher.rb |
milestoner-17.10.0 | lib/milestoner/commits/enricher.rb |
milestoner-17.9.0 | lib/milestoner/commits/enricher.rb |