Module: Padrino::Rendering::Erubi::SafeBufferEnhancer
- Included in:
- SafeErubi
- Defined in:
- lib/padrino/rendering/erubi_template.rb
Instance Method Summary collapse
- #add_expression_result(code) ⇒ Object
- #add_expression_result_escaped(code) ⇒ Object
- #add_text(text) ⇒ Object
Instance Method Details
#add_expression_result(code) ⇒ Object
5 6 7 |
# File 'lib/padrino/rendering/erubi_template.rb', line 5 def add_expression_result(code) @src << " @__in_ruby_literal = true; #{bufvar}.concat((" << code << ').to_s); @__in_ruby_literal = false;' end |
#add_expression_result_escaped(code) ⇒ Object
9 10 11 |
# File 'lib/padrino/rendering/erubi_template.rb', line 9 def add_expression_result_escaped(code) @src << " #{bufvar}.safe_concat (" << code << ");" end |
#add_text(text) ⇒ Object
13 14 15 |
# File 'lib/padrino/rendering/erubi_template.rb', line 13 def add_text(text) @src << " #{bufvar}.safe_concat '" << text.gsub(/['\\]/, '\\\\\&') << "';" unless text.empty? end |