Sha256: d93a69f4214ae7f4e2d52b3329421d218ba8243736e08d878fc37e707d4d34e9

Contents?: true

Size: 526 Bytes

Versions: 14

Compression:

Stored size: 526 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, key = :target_root, path: Pathname.pwd|
        content.fetch(:target_root) { path }
               .then { |value| content.merge! key => value }
               .then { |updated_content| Dry::Monads::Success updated_content }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubysmith-6.6.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.5.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.4.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.3.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.2.1 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.2.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.1.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-6.0.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.9.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.8.1 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.8.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.7.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.6.0 lib/rubysmith/configuration/transformers/target_root.rb
rubysmith-5.5.0 lib/rubysmith/configuration/transformers/target_root.rb