Class: Hanami::View::Rendering::LayoutRegistry Private
- Inherits:
-
Object
- Object
- Hanami::View::Rendering::LayoutRegistry
- Defined in:
- lib/hanami/view/rendering/layout_registry.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.
Holds the references of all the registered layouts. As now the registry is unique at the level of the framework.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(view) ⇒ LayoutRegistry
constructor
private
Initialize the registry.
-
#resolve(context) ⇒ Hanami::Layout, Hanami::View::Rendering::NullTemplate
private
Returns the layout for the given context.
Constructor Details
#initialize(view) ⇒ LayoutRegistry
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 the registry
21 22 23 24 25 |
# File 'lib/hanami/view/rendering/layout_registry.rb', line 21 def initialize(view) @registry = {} @view = view prepare! end |
Instance Method Details
#resolve(context) ⇒ Hanami::Layout, Hanami::View::Rendering::NullTemplate
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 layout for the given context.
41 42 43 |
# File 'lib/hanami/view/rendering/layout_registry.rb', line 41 def resolve(context) @registry.fetch(format(context)) { NullTemplate.new } end |