Class: Padrino::Rendering::ERBTemplate

Inherits:
Tilt::ERBTemplate
  • Object
show all
Defined in:
lib/padrino/rendering/erb_template.rb

Instance Method Summary collapse

Instance Method Details

#precompiled_preamble(locals) ⇒ Object



27
28
29
30
31
# File 'lib/padrino/rendering/erb_template.rb', line 27

def precompiled_preamble(locals)
  original = super
  return original unless @is_padrino_app
  "__in_erb_template = true\n" << original
end

#prepareObject



21
22
23
24
25
# File 'lib/padrino/rendering/erb_template.rb', line 21

def prepare
  @outvar = options[:outvar] || self.class.default_output_variable
  options[:trim] = '<>' if !(options[:trim] == false) && (options[:trim].nil? || options[:trim] == true)
  @engine = SafeERB.new(data, options[:safe], options[:trim], @outvar)
end

#render(*args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/padrino/rendering/erb_template.rb', line 13

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[:safe_buffer])
  super
end