Class: Hanami::View::Rendering::ViewFinder Private
- Inherits:
-
Object
- Object
- Hanami::View::Rendering::ViewFinder
- Defined in:
- lib/hanami/view/rendering/view_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 a view
Instance Method Summary collapse
-
#find(template) ⇒ Class
private
Find a view for the given template.
-
#initialize(view) ⇒ ViewFinder
constructor
private
Initialize a finder.
Constructor Details
#initialize(view) ⇒ ViewFinder
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
17 18 19 |
# File 'lib/hanami/view/rendering/view_finder.rb', line 17 def initialize(view) @view = view end |
Instance Method Details
#find(template) ⇒ Class
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 a view for the given template. It looks up for the current view and its subclasses.
31 32 33 |
# File 'lib/hanami/view/rendering/view_finder.rb', line 31 def find(template) @view.subclasses.find {|v| v.format == template.format } || @view end |