Class: Lita::TemplateResolver Private
- Inherits:
-
Object
- Object
- Lita::TemplateResolver
- Defined in:
- lib/lita/template_resolver.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.
Finds the file path of the most appropriate template for the given adapter.
Instance Method Summary collapse
-
#initialize(template_root, template_name, adapter_name) ⇒ TemplateResolver
constructor
private
A new instance of TemplateResolver.
-
#resolve ⇒ String
private
Returns the adapter-specific template, falling back to a generic template.
Constructor Details
#initialize(template_root, template_name, adapter_name) ⇒ TemplateResolver
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.
Returns a new instance of TemplateResolver.
9 10 11 12 13 |
# File 'lib/lita/template_resolver.rb', line 9 def initialize(template_root, template_name, adapter_name) @template_root = template_root @template_name = template_name @adapter_name = adapter_name end |
Instance Method Details
#resolve ⇒ String
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.
Returns the adapter-specific template, falling back to a generic template.
18 19 20 21 22 |
# File 'lib/lita/template_resolver.rb', line 18 def resolve return adapter_template if File.exist?(adapter_template) return generic_template if File.exist?(generic_template) raise MissingTemplateError, I18n.t("lita.template.missing_template", path: generic_template) end |