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
'*'.freeze
- 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
'*'.freeze
- 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
'**'.freeze
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
37 38 39 |
# File 'lib/hanami/mailer/rendering/templates_finder.rb', line 37 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
71 72 73 74 75 76 77 78 79 |
# File 'lib/hanami/mailer/rendering/templates_finder.rb', line 71 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 |