Sha256: 51d010f830ad58e036d1e80c057449a599adc4bd108f18bafac708781ec623ec
Contents?: true
Size: 710 Bytes
Versions: 14
Compression:
Stored size: 710 Bytes
Contents
# frozen_string_literal: true require "dry/monads" module Rubysmith module Configuration module Transformers # Dynamically adds GitHub user if user is defined. class GitHubUser include Import[:git] include Dry::Monads[:result] def initialize(key = :git_hub_user, **) @key = key super(**) end def call(content) = content[key] ? Success(content) : user_or(content) private attr_reader :key def user_or content git.get("github.user", 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