Method: Arrow::HTMLUtilities.escape_html
- Defined in:
- lib/arrow/mixins.rb
.escape_html(string) ⇒ Object
Escape special characters in the given string for display in an HTML inspection interface. This escapes common invisible characters like tabs and carriage-returns in additional to the regular HTML escapes.
170 171 172 173 174 175 176 177 178 179 |
# File 'lib/arrow/mixins.rb', line 170 def escape_html( string ) return "nil" if string.nil? string = string.inspect unless string.is_a?( String ) string. gsub(/&/, '&'). gsub(/</, '<'). gsub(/>/, '>'). gsub(/\n/, '↵'). gsub(/\t/, '→') end |