module Formular::HtmlEscape

Constants

HTML_ESCAPE

see activesupport/lib/active_support/core_ext/string/output_safety.rb

HTML_ESCAPE_ONCE_REGEXP
HTML_ESCAPE_REGEXP

Public Instance Methods

html_escape(string) click to toggle source

A utility method for escaping HTML tag characters.

# File lib/formular/html_escape.rb, line 10
def html_escape(string)
  string.to_s.gsub(HTML_ESCAPE_REGEXP, HTML_ESCAPE)
end
html_escape_once(string) click to toggle source

A utility method for escaping HTML without affecting existing escaped entities.

# File lib/formular/html_escape.rb, line 15
def html_escape_once(string)
  string.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE)
end