Module: Ea::XmlEscape
- Defined in:
- lib/ea/xml_escape.rb
Overview
Shared XML entity escaping. Centralised so the four subsystems that emit XML/XMI/SVG (Transformers, Diff, Shapescript, Svg) share one implementation instead of four local copies with subtle differences (quote-escaping was inconsistent).
Class Method Summary collapse
-
.call(text) ⇒ String
XML-escaped text with &, <, >, " replaced.
Class Method Details
.call(text) ⇒ String
Returns XML-escaped text with &, <, >, " replaced.
13 14 15 16 17 18 19 |
# File 'lib/ea/xml_escape.rb', line 13 def call(text) text.to_s .gsub("&", "&") .gsub("<", "<") .gsub(">", ">") .gsub('"', """) end |