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



49
50
51
52
53
# File 'lib/padrino/rendering/erb_template.rb', line 49

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

#prepareObject



34
35
36
37
38
39
# File 'lib/padrino/rendering/erb_template.rb', line 34

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, trim_mode: options[:trim], eoutvar: @outvar)
end

#render(*args) ⇒ Object



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

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