Sha256: b459932b87cdc3c9b5617fc956abb0e56c85357a4d4bc8fb2bbacf4ee0c1eca1
Contents?: true
Size: 699 Bytes
Versions: 14
Compression:
Stored size: 699 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 initialize(key = :author_email, **) @key = key super(**) end def call(content) = content[key] ? Success(content) : email_or(content) private attr_reader :key def email_or content git.get("user.email", nil) .fmap { |value| value ? content.merge!(key => value) : content } .or { Success content } end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems