Sha256: 6b9083f48ef09588e0a3183ac0980d73fabccd4ffd641f8297802f741e1921c9
Contents?: true
Size: 799 Bytes
Versions: 12
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true require "dry/monads" require "refinements/array" module Rubysmith module Configuration module Transformers # Appends custom path to default template roots. class TemplateRoot include Dry::Monads[:result] using Refinements::Array def initialize key = :template_roots, default: Pathname(__dir__).join("../../templates") @key = key @default = default end def call attributes Array(default).map { |path| Pathname path } .including(attributes[key]) .compact .then { |value| Success attributes.merge!(key => value) } end private attr_reader :key, :default end end end end
Version data entries
12 entries across 12 versions & 1 rubygems