Class: Sitepress::AssetRenderer
- Inherits:
-
Object
- Object
- Sitepress::AssetRenderer
- Defined in:
- lib/sitepress-server.rb
Overview
TODO: These renderers are confusing. They need to render a resource, be able to wrap a resource with another resource, and have rendering partial from within the context of the resource redender.
Instance Method Summary collapse
-
#initialize(asset) ⇒ AssetRenderer
constructor
A new instance of AssetRenderer.
- #render(locals: {}, layout: nil, context:, &block) ⇒ Object
Constructor Details
#initialize(asset) ⇒ AssetRenderer
Returns a new instance of AssetRenderer.
9 10 11 |
# File 'lib/sitepress-server.rb', line 9 def initialize(asset) @asset = asset end |
Instance Method Details
#render(locals: {}, layout: nil, context:, &block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/sitepress-server.rb', line 13 def render(locals: {}, layout: nil, context: , &block) template = engine.new { @asset.body } with_layout layout: layout, context: context do template.render(context, **locals, &block) end end |