Sha256: 79a21e7c2b4c4b5fe061c1a89024f2fed5f1f8992b5f2c0d5b602d9306312bc4

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "refinements/arrays"

module Rubysmith
  module Configuration
    # Prepends template roots to existing content.
    module Transformers
      include Dry::Monads[:result]

      using Refinements::Arrays

      TemplateRoot = lambda do |content, overrides: Pathname(__dir__).join("../../templates")|
        Array(overrides).map { |path| Pathname path }
                        .including(content[:template_roots])
                        .compact
                        .then { |paths| Dry::Monads::Success content.merge!(template_roots: paths) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubysmith-5.0.1 lib/rubysmith/configuration/transformers/template_root.rb