Class: Bridgetown::LiquidRenderer::File
- Inherits:
-
Object
- Object
- Bridgetown::LiquidRenderer::File
- Defined in:
- bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb
Overview
TODO: deprecate or move to a separate repo/plugin
Instance Method Summary collapse
-
#initialize(renderer, filename) ⇒ File
constructor
A new instance of File.
-
#parse(content) ⇒ Object
-
#render(*args) ⇒ Object
-
#render!(*args) ⇒ Object
This method simply ‘rethrows any error’ before attempting to render the template.
-
#warnings ⇒ Object
Constructor Details
#initialize(renderer, filename) ⇒ File
Returns a new instance of File.
7 8 9 10 |
# File 'bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb', line 7 def initialize(renderer, filename) @renderer = renderer @filename = filename end |
Instance Method Details
#parse(content) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb', line 12 def parse(content) measure_time do @renderer.cache[@filename] ||= Liquid::Template.parse( content, line_numbers: true ) end @template = @renderer.cache[@filename] self end |
#render(*args) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb', line 23 def render(*args) measure_time do measure_bytes do measure_counts do @template.render(*args) end end end end |
#render!(*args) ⇒ Object
This method simply ‘rethrows any error’ before attempting to render the template.
34 35 36 37 38 39 40 41 42 |
# File 'bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb', line 34 def render!(*args) measure_time do measure_bytes do measure_counts do @template.render!(*args) end end end end |
#warnings ⇒ Object
44 45 46 |
# File 'bridgetown-core/lib/bridgetown-core/liquid_renderer/file.rb', line 44 def warnings @template.warnings end |