Sha256: 33f9b999f7f5e94795f969c97a39afb2037da569536411fd5aa88048636a9162

Contents?: true

Size: 614 Bytes

Versions: 5

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

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

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

        Label = lambda do |attributes, key = :project_label, default: Pathname.pwd.basename.to_s|
          attributes.fetch(key) { attributes.merge!(key => default.titleize).compress! }
          Dry::Monads::Success attributes
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
milestoner-18.3.0 lib/milestoner/configuration/transformers/project/label.rb
milestoner-18.2.0 lib/milestoner/configuration/transformers/project/label.rb
milestoner-18.1.0 lib/milestoner/configuration/transformers/project/label.rb
milestoner-18.0.1 lib/milestoner/configuration/transformers/project/label.rb
milestoner-18.0.0 lib/milestoner/configuration/transformers/project/label.rb