Module: Erubis::XmlHelper
- Defined in:
- lib/erubis/helper.rb
Overview
helper for xml
Constant Summary collapse
- ESCAPE_TABLE =
{ '&' => '&', '<' => '<', '>' => '>', '"' => '"', "'" => ''', }
Class Method Summary collapse
- .escape_xml(value) ⇒ Object (also: h, html_escape)
Class Method Details
.escape_xml(value) ⇒ Object Also known as: h, html_escape
25 26 27 28 |
# File 'lib/erubis/helper.rb', line 25 def escape_xml(value) value.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] } # or /[&<>"']/ #value.to_s.gsub(/[&<>"]/) { ESCAPE_TABLE[$&] } end |