Class: Middleman::Renderers::ERb::Template
- Inherits:
-
Tilt::ErubiTemplate
- Object
- Tilt::ErubiTemplate
- Middleman::Renderers::ERb::Template
- Defined in:
- lib/middleman-core/renderers/erb.rb
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ Template
constructor
A new instance of Template.
-
#precompiled_preamble(locals) ⇒ Object
In preamble we need a flag
__in_erb_template
for padrino apps. -
#precompiled_template(locals) ⇒ Object
Force the template the use the configured encoding.
Constructor Details
#initialize(*args, &block) ⇒ Template
Returns a new instance of Template.
10 11 12 13 14 |
# File 'lib/middleman-core/renderers/erb.rb', line 10 def initialize(*args, &block) super @context = @options[:context] end |
Instance Method Details
#precompiled_preamble(locals) ⇒ Object
In preamble we need a flag __in_erb_template
for padrino apps.
19 20 21 22 |
# File 'lib/middleman-core/renderers/erb.rb', line 19 def precompiled_preamble(locals) original = super "__in_erb_template = true\n" << original end |
#precompiled_template(locals) ⇒ Object
Force the template the use the configured encoding.
27 28 29 30 31 32 33 |
# File 'lib/middleman-core/renderers/erb.rb', line 27 def precompiled_template(locals) if @context super.dup.force_encoding(@context.app.config[:encoding]) else super end end |