Sha256: b0e4b50b0d2a6bd16473daa57853991e32f98633d7f1766f8fda9eee0ea5e241
Contents?: true
Size: 588 Bytes
Versions: 3
Compression:
Stored size: 588 Bytes
Contents
# frozen_string_literal: true require "dry/monads" module Rubysmith module Configuration module Transformers # Dynamically adds Git email if defined. class GitEmail include Import[:git] include Dry::Monads[:result] def call(content) = content[:author_email] ? Success(content) : email_or(content) private def email_or content git.get("user.email", nil) .fmap { |email| email ? content.merge!(author_email: email) : content } .or { Success content } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems