class Padrino::Rendering::ErubisTemplate

Modded ErubisTemplate that doesn’t insist in an String as output buffer.

@api private

Public Instance Methods

precompiled_preamble(locals) click to toggle source

In preamble we need a flag ‘__in_erb_template` and SafeBuffer for padrino apps.

Calls superclass method
# File lib/padrino/rendering/erubis_template.rb, line 53
def precompiled_preamble(locals)
  original = super
  return original unless @is_padrino_app
  "__in_erb_template = true\n" << original.rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
end
render(*args) click to toggle source
Calls superclass method
# File lib/padrino/rendering/erubis_template.rb, line 42
def render(*args)
  app       = args.first
  app_class = app.class
  @is_padrino_app = (defined?(Padrino::Application) && app.kind_of?(Padrino::Application)) || 
                    (app_class.respond_to?(:erb) && app_class.erb[:engine_class] == Padrino::Rendering::SafeEruby)
  super
end