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



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

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



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

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