Sha256: 5fa9347029efdc2060515a4863447bd8374c283fc8f6cb691b52fd61df6513d3

Contents?: true

Size: 683 Bytes

Versions: 18

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

require "git_plus"
require "refinements/strings"
require "refinements/structs"

module Rubysmith
  module Configuration
    module Enhancers
      # Dynamically adds Git email if defined.
      class GitEmail
        using Refinements::Strings
        using Refinements::Structs

        def initialize repository: GitPlus::Repository.new
          @repository = repository
        end

        def call content
          String(content.author_email).blank? ? content.merge(author_email: email) : content
        end

        private

        attr_reader :repository

        def email = repository.config_get("user.email")
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rubysmith-3.8.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.7.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.6.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.5.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.4.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.3.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.2.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.1.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.0.1 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-3.0.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-2.0.2 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-2.0.1 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-2.0.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-1.3.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-1.2.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-1.1.1 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-1.1.0 lib/rubysmith/configuration/enhancers/git_email.rb
rubysmith-1.0.0 lib/rubysmith/configuration/enhancers/git_email.rb