Module: Erubis::BlockAwareEnhancer
- Included in:
- BlockAwareEruby
- Defined in:
- lib/merb-core/controller/template.rb
Instance Method Summary collapse
- #add_expr_escaped(src, code) ⇒ Object
- #add_expr_literal(src, code) ⇒ Object
- #add_postamble(src) ⇒ Object
- #add_preamble(src) ⇒ Object
- #add_stmt2(src, code, tailch) ⇒ Object
- #add_text(src, text) ⇒ Object
Instance Method Details
#add_expr_escaped(src, code) ⇒ Object
221 222 223 |
# File 'lib/merb-core/controller/template.rb', line 221 def add_expr_escaped(src, code) src << ' @_erb_buf.concat(' << escaped_expr(code) << ');' end |
#add_expr_literal(src, code) ⇒ Object
231 232 233 234 235 236 237 |
# File 'lib/merb-core/controller/template.rb', line 231 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
212 213 214 215 |
# File 'lib/merb-core/controller/template.rb', line 212 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
207 208 209 210 |
# File 'lib/merb-core/controller/template.rb', line 207 def add_preamble(src) src << "_old_buf, @_erb_buf = @_erb_buf, ''; " src << "@_engine = 'erb'; " end |
#add_stmt2(src, code, tailch) ⇒ Object
225 226 227 228 229 |
# File 'lib/merb-core/controller/template.rb', line 225 def add_stmt2(src, code, tailch) src << code src << " ).to_s; " if tailch == "=" src << ';' unless code[-1] == ?\n end |
#add_text(src, text) ⇒ Object
217 218 219 |
# File 'lib/merb-core/controller/template.rb', line 217 def add_text(src, text) src << " @_erb_buf.concat('" << escape_text(text) << "'); " end |