Method: ActiveSupport::CoreExt::ERBUtil#html_escape
- Defined in:
-
activesupport/lib/active_support/core_ext/erb/util.rb,
activesupport/lib/active_support/core_ext/erb/util.rb
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 > 0 & a < 10?
10 11 12 13 14 15 16 17 |
# File 'activesupport/lib/active_support/core_ext/erb/util.rb', line 10 def html_escape(s) # :nodoc: s = s.to_s if s.html_safe? s else super(ActiveSupport::Multibyte::Unicode.tidy_bytes(s)) end end |