Class: Hanami::Mailer::Rendering::TemplatesFinder Private
- Inherits:
-
Object
- Object
- Hanami::Mailer::Rendering::TemplatesFinder
- Defined in:
- lib/hanami/mailer/rendering/templates_finder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Find templates for a mailer
Constant Summary collapse
- FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default format
"*"
- ENGINES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default template engines
"*"
- RECURSIVE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Recursive pattern
"**"
Instance Method Summary collapse
-
#find ⇒ Hash
private
Find all the associated templates to the mailer.
-
#initialize(mailer) ⇒ TemplatesFinder
constructor
private
Initialize a finder.
Constructor Details
#initialize(mailer) ⇒ TemplatesFinder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a finder
39 40 41 |
# File 'lib/hanami/mailer/rendering/templates_finder.rb', line 39 def initialize(mailer) @mailer = mailer end |
Instance Method Details
#find ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Find all the associated templates to the mailer. It recursively looks for templates under the root path of the mailer, that are matching the template name
73 74 75 76 77 78 79 80 81 |
# File 'lib/hanami/mailer/rendering/templates_finder.rb', line 73 def find templates = Hash[] _find.map do |template| name = File.basename(template) format = (name.split(".")[-2]).to_sym templates[format] = Mailer::Template.new(template) end templates end |