Class: ActionView::Template::Handlers::ERB::Erubi

Inherits:
Erubi::Engine
  • Object
show all
Defined in:
lib/action_view/template/handlers/erb/erubi.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, properties = {}) ⇒ Erubi

:nodoc: all



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/action_view/template/handlers/erb/erubi.rb', line 11

def initialize(input, properties = {})
  @newline_pending = 0

  # Dup properties so that we don't modify argument
  properties = Hash[properties]
  properties[:preamble]   = "@output_buffer = output_buffer || ActionView::OutputBuffer.new;"
  properties[:postamble]  = "@output_buffer.to_s"
  properties[:bufvar]     = "@output_buffer"
  properties[:escapefunc] = ""

  super
end

Instance Method Details

#evaluate(action_view_erb_handler_context) ⇒ Object



24
25
26
27
# File 'lib/action_view/template/handlers/erb/erubi.rb', line 24

def evaluate(action_view_erb_handler_context)
  pr = eval("proc { #{@src} }", binding, @filename || "(erubi)")
  action_view_erb_handler_context.instance_eval(&pr)
end