module Padrino::Rendering::SafeBufferEnhancer
SafeBufferEnhancer
is an Erubis Enhancer that compiles templates that are fit for using ActiveSupport::SafeBuffer as a Buffer.
@api private
Public Instance Methods
add_expr_escaped(src, code)
click to toggle source
# File lib/padrino/rendering/erubis_template.rb, line 19 def add_expr_escaped(src, code) src << " #{@bufvar}.safe_concat " << code << ';' end
add_expr_literal(src, code)
click to toggle source
# File lib/padrino/rendering/erubis_template.rb, line 9 def add_expr_literal(src, code) src << " #{@bufvar}.concat((" << code << ').to_s);' end
add_stmt(src, code)
click to toggle source
# File lib/padrino/rendering/erubis_template.rb, line 13 def add_stmt(src, code) code = code.sub('end', 'nil;end') if code =~ /\A\s*end\s*\Z/ src << code src << ';' unless code[-1] == ?\n end
add_text(src, text)
click to toggle source
# File lib/padrino/rendering/erubis_template.rb, line 23 def add_text(src, text) src << " #{@bufvar}.safe_concat '" << escape_text(text) << "';" unless text.empty? end