End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CGI::Util#escape_element
escape_element(string, *elements)
lib/cgi/util.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/cgi/util.rb, line 178
def escapeElement(string, *elements)
elements = elements[0] if elements[0].kind_of?(Array)
unless elements.empty?
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do
CGI.escapeHTML($&)
end
else
string
end
end
Alias of #escapeElement
Synonym for CGI.escapeElement(str)