Sha256: ddcce832b301bc114240869c888d9b480510c27c8839175be746237add4cbe2b
Contents?: true
Size: 819 Bytes
Versions: 18
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true require "git_plus" require "refinements/strings" require "refinements/structs" module Rubysmith module Configuration module Enhancers # Dynamically adds Git user if defined. class GitUser using Refinements::Strings using Refinements::Structs def initialize repository: GitPlus::Repository.new @repository = repository end def call(content) = String(content.author_name).blank? ? content.merge(**user) : content private attr_reader :repository def user repository.config_get("user.name") .then { |name| String(name).split } .then { |first, last| {author_given_name: first, author_family_name: last} } end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems