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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



264
265
266
# File 'lib/merb-core/controller/template.rb', line 264

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

#add_expr_literal(src, code) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



247
248
249
250
# File 'lib/merb-core/controller/template.rb', line 247

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

#add_stmt2(src, code, tailch) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

#add_text(src, text) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



259
260
261
# File 'lib/merb-core/controller/template.rb', line 259

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