Class: ActionView::Template::Handlers::Erubis
- Inherits:
-
Erubis::Eruby
- Object
- Erubis::Eruby
- ActionView::Template::Handlers::Erubis
- Defined in:
- actionpack/lib/action_view/template/handlers/erb.rb
Constant Summary
- BLOCK_EXPR =
/\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
Instance Method Summary (collapse)
- - (Object) add_expr_escaped(src, code)
- - (Object) add_expr_literal(src, code)
- - (Object) add_postamble(src)
- - (Object) add_preamble(src)
- - (Object) add_text(src, text)
Instance Method Details
- (Object) add_expr_escaped(src, code)
43 44 45 46 47 48 49 |
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 43 def add_expr_escaped(src, code) if code =~ BLOCK_EXPR src << "@output_buffer.safe_append= " << code else src << "@output_buffer.safe_concat((" << code << ").to_s);" end end |
- (Object) add_expr_literal(src, code)
35 36 37 38 39 40 41 |
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 35 def add_expr_literal(src, code) if code =~ BLOCK_EXPR src << '@output_buffer.append= ' << code else src << '@output_buffer.append= (' << code << ');' end end |
- (Object) add_postamble(src)
51 52 53 |
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 51 def add_postamble(src) src << '@output_buffer.to_s' end |
- (Object) add_preamble(src)
24 25 26 |
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 24 def add_preamble(src) src << "@output_buffer = ActionView::OutputBuffer.new;" end |
- (Object) add_text(src, text)
28 29 30 31 |
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 28 def add_text(src, text) return if text.empty? src << "@output_buffer.safe_concat('" << escape_text(text) << "');" end |