instance method
html_escape_once
Ruby on Rails 4.0.13
Since v4.0.13 PrivateSignature
html_escape_once(s)
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"
Parameters
-
sreq
Source
# File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 44
def html_escape_once(s)
result = s.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE)
s.html_safe? ? result.html_safe : result
end
Defined in activesupport/lib/active_support/core_ext/string/output_safety.rb line 44
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ERB::Util