Class: Rubysmith::Configuration::Transformers::TemplateRoot
- Inherits:
-
Object
- Object
- Rubysmith::Configuration::Transformers::TemplateRoot
- Defined in:
- lib/rubysmith/configuration/transformers/template_root.rb
Overview
Appends custom content to default template roots.
Instance Method Summary collapse
- #call(content) ⇒ Object
-
#initialize(default = Pathname(__dir__).join("../../templates")) ⇒ TemplateRoot
constructor
A new instance of TemplateRoot.
Constructor Details
#initialize(default = Pathname(__dir__).join("../../templates")) ⇒ TemplateRoot
Returns a new instance of TemplateRoot.
15 16 17 |
# File 'lib/rubysmith/configuration/transformers/template_root.rb', line 15 def initialize default = Pathname(__dir__).join("../../templates") @default = default end |
Instance Method Details
#call(content) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/rubysmith/configuration/transformers/template_root.rb', line 19 def call content Array(default).map { |path| Pathname path } .including(content[:template_roots]) .compact .then { |paths| Success content.merge!(template_roots: paths) } end |