123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::CoreExt::ERBUtil

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: activesupport/lib/active_support/core_ext/erb/util.rb

Instance Method Summary

Instance Method Details

#h(s)

Alias for #html_escape.

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/erb/util.rb', line 28

alias h html_escape

#html_escape(s) Also known as: #unwrapped_html_escape, #h

This method is for internal use only.

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?

See additional method definition at line 10.

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/erb/util.rb', line 25

def html_escape(s) # :nodoc:
  s = s.to_s
  if s.html_safe?
    s
  else
    super(ActiveSupport::Multibyte::Unicode.tidy_bytes(s))
  end
end

#unwrapped_html_escape(s)

This method is for internal use only.

Alias for #html_escape.

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/erb/util.rb', line 18

alias :unwrapped_html_escape :html_escape # :nodoc: