Sha256: 4e2ee4dcb8f51b095b4ab6c7af3b269557b277bb16a746c4977e839b9f2186a5

Contents?: true

Size: 510 Bytes

Versions: 5

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Rubysmith
  module Configuration
    # Sets target root which defaults to current directory when key is missing.
    module Transformers
      include Dry::Monads[:result]

      TargetRoot = lambda do |content, path: Pathname.pwd|
        content.fetch(:target_root) { path }
               .then { |root| content.merge! target_root: root }
               .then { |updated_content| Dry::Monads::Success updated_content }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysmith-5.4.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.3.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.2.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.1.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.0.1 lib/rubysmith/configuration/transformers/target_root.rb