Class: Spirit::Render::Processors::LayoutProcessor
- Defined in:
- lib/spirit/render/processors/layout_processor.rb
Overview
Post-processes a layout in HAML.
Constant Summary collapse
- TEMPLATE =
File.join VIEWS, 'layout.haml'
Instance Attribute Summary collapse
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#renderer ⇒ Object
Returns the value of attribute renderer.
Instance Method Summary collapse
-
#initialize(renderer, *args) ⇒ LayoutProcessor
constructor
A new instance of LayoutProcessor.
- #render(document) ⇒ Object
Methods inherited from Base
events, inherited, #invoke_callbacks_for, process
Constructor Details
#initialize(renderer, *args) ⇒ LayoutProcessor
Returns a new instance of LayoutProcessor.
13 14 15 16 17 |
# File 'lib/spirit/render/processors/layout_processor.rb', line 13 def initialize(renderer, *args) template = File.read TEMPLATE @engine = Haml::Engine.new template, HAML_CONFIG @renderer = renderer end |
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine.
10 11 12 |
# File 'lib/spirit/render/processors/layout_processor.rb', line 10 def engine @engine end |
#renderer ⇒ Object
Returns the value of attribute renderer.
10 11 12 |
# File 'lib/spirit/render/processors/layout_processor.rb', line 10 def renderer @renderer end |
Instance Method Details
#render(document) ⇒ Object
19 20 21 22 |
# File 'lib/spirit/render/processors/layout_processor.rb', line 19 def render(document) engine.render renderer, content: document.force_encoding('utf-8') end |