Sha256: ce683f5806c04b804faf5585cdaa429cf49aa283c80bcb8a409fe23df51a314b

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "gitt"

module Rubysmith
  module Configuration
    # Dynamically adds GitHub user if user is defined.
    module Transformers
      include Dry::Monads[:result]

      GitHubUser = lambda do |content, git: Gitt::Repository.new|
        return Dry::Monads::Success content if content[:git_hub_user]

        git.get("github.user").fmap { |user| content.merge! git_hub_user: user }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubysmith-5.0.1 lib/rubysmith/configuration/transformers/git_hub_user.rb