Class: Roda::RodaPlugins::ErubisEscaping::Eruby
- Inherits:
-
Erubis::EscapedEruby
- Object
- Erubis::EscapedEruby
- Roda::RodaPlugins::ErubisEscaping::Eruby
- Defined in:
- lib/roda/plugins/_erubis_escaping.rb
Overview
Optimized subclass that fixes escaping of postfix conditionals.
Instance Method Summary collapse
-
#add_expr_escaped(src, code) ⇒ Object
Fix bug in Erubis::EscapedEruby where postfix conditionals inside <%= %> are broken (e.g. <%= foo if bar %> ), and optimize by using a local variable instead of a constant lookup.
-
#convert_input(codebuf, input) ⇒ Object
Set escaping class to a local variable, so you don’t need a constant lookup per escape.
Instance Method Details
#add_expr_escaped(src, code) ⇒ Object
Fix bug in Erubis::EscapedEruby where postfix conditionals inside <%= %> are broken (e.g. <%= foo if bar %> ), and optimize by using a local variable instead of a constant lookup.
20 21 22 |
# File 'lib/roda/plugins/_erubis_escaping.rb', line 20 def add_expr_escaped(src, code) src << " #{@bufvar} << _erubis_xml_helper.escape_xml((" << code << '));' end |
#convert_input(codebuf, input) ⇒ Object
Set escaping class to a local variable, so you don’t need a constant lookup per escape.
12 13 14 15 |
# File 'lib/roda/plugins/_erubis_escaping.rb', line 12 def convert_input(codebuf, input) codebuf << '_erubis_xml_helper = Erubis::XmlHelper;' super end |