Module: Erubis::BlockAwareEnhancer

Included in:
BlockAwareEruby
Defined in:
lib/merb-core/controller/template.rb

Instance Method Summary collapse

Instance Method Details

#add_expr_escaped(src, code) ⇒ Object

:api: private


272
273
274
# File 'lib/merb-core/controller/template.rb', line 272

def add_expr_escaped(src, code)
  src << ' @_erb_buf.concat(' << escaped_expr(code) << ');'
end

#add_expr_literal(src, code) ⇒ Object

:api: private


284
285
286
287
288
289
290
# File 'lib/merb-core/controller/template.rb', line 284

def add_expr_literal(src, code)
  if code =~ /(do|\{)(\s*\|[^|]*\|)?\s*\Z/
    src << ' @_erb_buf.concat( (' << code << "; "
  else
    src << ' @_erb_buf.concat((' << code << ').to_s);'
  end
end

#add_postamble(src) ⇒ Object

:api: private


261
262
263
264
# File 'lib/merb-core/controller/template.rb', line 261

def add_postamble(src)
  src << "\n" unless src[-1] == ?\n      
  src << "_ret = @_erb_buf; @_erb_buf = _old_buf; _ret.to_s;\n"
end

#add_preamble(src) ⇒ Object

:api: private


255
256
257
258
# File 'lib/merb-core/controller/template.rb', line 255

def add_preamble(src)
  src << "_old_buf, @_erb_buf = @_erb_buf, ''; "
  src << "@_engine = 'erb'; "
end

#add_stmt2(src, code, tailch) ⇒ Object

:api: private


277
278
279
280
281
# File 'lib/merb-core/controller/template.rb', line 277

def add_stmt2(src, code, tailch)
  src << code
  src << ") ).to_s; " if tailch == "="
  src << ';' unless code[-1] == ?\n
end

#add_text(src, text) ⇒ Object

:api: private


267
268
269
# File 'lib/merb-core/controller/template.rb', line 267

def add_text(src, text)
  src << " @_erb_buf.concat('" << escape_text(text) << "'); "
end