Method: ERB::Util.html_escape_once
- Defined in:
- activesupport/lib/active_support/core_ext/erb/util.rb
.html_escape_once(s) ⇒ Object
A utility method for escaping HTML without affecting existing escaped entities.
html_escape_once('1 < 2 & 3')
# => "1 < 2 & 3"
html_escape_once('<< Accept & Checkout')
# => "<< Accept & Checkout"
63 64 65 |
# File 'activesupport/lib/active_support/core_ext/erb/util.rb', line 63 def html_escape_once(s) ActiveSupport::Multibyte::Unicode.tidy_bytes(s.to_s).gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE).html_safe end |