Module: ArchUnit::GraphReporting::Rendering::Escaping
- Defined in:
- lib/archunit/graph/rendering/escaping.rb
Overview
Format-specific escaping kept out of the renderers' graph logic.
Class Method Summary collapse
- .html(value) ⇒ Object
- .mermaid_label(value) ⇒ Object
- .quoted(value) ⇒ Object
- .single_line(value) ⇒ Object
Class Method Details
.html(value) ⇒ Object
21 22 23 |
# File 'lib/archunit/graph/rendering/escaping.rb', line 21 def html(value) CGI.escapeHTML(value.to_s) end |
.mermaid_label(value) ⇒ Object
17 18 19 |
# File 'lib/archunit/graph/rendering/escaping.rb', line 17 def mermaid_label(value) CGI.escapeHTML(value).gsub("\n", '<br/>') end |
.quoted(value) ⇒ Object
12 13 14 15 |
# File 'lib/archunit/graph/rendering/escaping.rb', line 12 def quoted(value) escaped = value.gsub('\\', '\\\\').gsub('"', '\\"').gsub("\n", '\\n') "\"#{escaped}\"" end |
.single_line(value) ⇒ Object
25 26 27 |
# File 'lib/archunit/graph/rendering/escaping.rb', line 25 def single_line(value) value.gsub(/[\r\n]+/, ' ') end |