Class: Hanami::View::Rendering::PartialTemplatesFinder Private
- Inherits:
-
Object
- Object
- Hanami::View::Rendering::PartialTemplatesFinder
- Defined in:
- lib/hanami/view/rendering/partial_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 partial templates in the file system
Constant Summary collapse
- PARTIAL_PATTERN =
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.
Search pattern for partial file names
'_*'.freeze
- PARTIAL_PARTS_SEPARATOR =
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.
'.'.freeze
Instance Attribute Summary collapse
- #configuration ⇒ Object readonly private
Instance Method Summary collapse
-
#find ⇒ Array
private
Find partials under the given path.
-
#initialize(configuration) ⇒ PartialTemplatesFinder
constructor
private
Initializes a new PartialTemplatesFinder.
Constructor Details
#initialize(configuration) ⇒ PartialTemplatesFinder
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.
Initializes a new PartialTemplatesFinder
34 35 36 |
# File 'lib/hanami/view/rendering/partial_templates_finder.rb', line 34 def initialize(configuration) @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
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.
26 27 28 |
# File 'lib/hanami/view/rendering/partial_templates_finder.rb', line 26 def configuration @configuration end |
Instance Method Details
#find ⇒ Array
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 partials under the given path
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/hanami/view/rendering/partial_templates_finder.rb', line 44 def find _find_partials(configuration.root).map do |template| partial_path, partial_base_name = Pathname(template).relative_path_from(configuration.root).split partial_base_parts = partial_base_name.to_s.split(PARTIAL_PARTS_SEPARATOR) PartialFile.new( "#{partial_path}#{::File::SEPARATOR}#{partial_base_parts[0]}", partial_base_parts[1], View::Template.new(template, configuration.default_encoding) ) end end |