Class: Sitepress::AssetTemplate
- Inherits:
-
Object
- Object
- Sitepress::AssetTemplate
- Defined in:
- lib/sitepress/asset_template.rb
Overview
Since we use Frontmatter, we have to do some parsing to get a Tilt template working properly.
Instance Attribute Summary collapse
-
#asset ⇒ Object
readonly
Returns the value of attribute asset.
Instance Method Summary collapse
-
#initialize(asset) ⇒ AssetTemplate
constructor
A new instance of AssetTemplate.
- #render(*args, &block) ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(asset) ⇒ AssetTemplate
Returns a new instance of AssetTemplate.
9 10 11 |
# File 'lib/sitepress/asset_template.rb', line 9 def initialize(asset) @asset = ceorce_asset(asset) end |
Instance Attribute Details
#asset ⇒ Object (readonly)
Returns the value of attribute asset.
7 8 9 |
# File 'lib/sitepress/asset_template.rb', line 7 def asset @asset end |
Instance Method Details
#render(*args, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/sitepress/asset_template.rb', line 13 def render(*args, &block) if renderable_resource? template.render(*args, &block) else asset.body end end |
#template ⇒ Object
21 22 23 |
# File 'lib/sitepress/asset_template.rb', line 21 def template @_template ||= engine.new{ asset.body } end |