Sha256: 5f9e9f06f9831513a4bc44ccd89326437d44c5e4fe62af0ff0539580ea692039

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "pathname"
require "refinements/hash"

module Milestoner
  module Configuration
    module Transformers
      # Conditionally updates name based on current directory.
      module Project
        using Refinements::Hash

        Name = lambda do |attributes, key = :project_name, default: Pathname.pwd.basename.to_s|
          attributes.fetch_value(key) { default }
                    .then { |value| Dry::Monads::Success attributes.merge!(key => value) }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/configuration/transformers/project/name.rb
milestoner-17.10.0 lib/milestoner/configuration/transformers/project/name.rb
milestoner-17.9.0 lib/milestoner/configuration/transformers/project/name.rb