Sha256: 1e5813f9f9c952334b0f8f27bbb3aef83e93410c80bbecededccfe1f510ea52a

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

require "gitt"
require "refinements/strings"
require "refinements/structs"

module Rubysmith
  module Configuration
    module Enhancers
      # Dynamically adds GitHub user if user is defined.
      class GitHubUser
        using Refinements::Strings
        using Refinements::Structs

        def initialize git: Gitt::Repository.new
          @git = git
        end

        def call content
          String(content.git_hub_user).blank? ? content.merge(git_hub_user: user) : content
        end

        private

        attr_reader :git

        def user = git.get "github.user"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysmith-4.1.0 lib/rubysmith/configuration/enhancers/git_hub_user.rb
rubysmith-4.0.1 lib/rubysmith/configuration/enhancers/git_hub_user.rb
rubysmith-4.0.0 lib/rubysmith/configuration/enhancers/git_hub_user.rb