Sha256: 3199e90a5aeb2b77d8bfa5fc097eb959c115842cb5f43dc9babf55952bcfa01c

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Milestoner
  module Configuration
    module Transformers
      module Project
        # Conditionally updates author based on Git user.
        class Author
          include Import[:git]
          include Dry::Monads[:result]

          def initialize(key = :project_author, **)
            @key = key
            super(**)
          end

          def call content
            content.fetch(key) { git.get("user.name", nil).value_or(nil) }
                   .tap { |value| content[key] = value if value }

            Success content
          end

          private

          attr_reader :key
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-17.0.0 lib/milestoner/configuration/transformers/project/author.rb