Sha256: e98c55ac669bc5e5b7fafe58b50acb22cb5c5a4a908ab10dca51b32ce2f4af60

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "pathname"
require "refinements/string"

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

        Label = lambda do |content, key = :project_label, default: Pathname.pwd.basename.to_s|
          content.fetch(key) { default }
                 .tap { |value| content[key] = value.titleize }

          Dry::Monads::Success content
        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/label.rb