instance method html_escape

Ruby on Rails 8.0.4

Since v7.1.6 Private

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

html_escape(s)

A utility method for escaping HTML tag characters. This method is also aliased as h.

puts html_escape('is a > 0 & a < 10?')
# => is a &gt; 0 &amp; a &lt; 10?

Parameters

s req
Source
# File activesupport/lib/active_support/core_ext/erb/util.rb, line 25
      def html_escape(s) # rubocop:disable Lint/DuplicateMethods
        unwrapped_html_escape(s).html_safe
      end

Defined in activesupport/lib/active_support/core_ext/erb/util.rb line 25 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::CoreExt::ERBUtil

Type at least 2 characters to search.

↑↓ navigate · open · esc close