123456789_123456789_123456789_123456789_123456789_

Module: ERB::Escape

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: ext/erb/escape/escape.c,
lib/erb/util.rb

Class Method Summary

  • .html_escape(s) (also: #h) mod_func

    ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped.

Class Method Details

.html_escape(s) (mod_func) Also known as: #h

ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped

[ GitHub ]

  
# File 'ext/erb/escape/escape.c', line 71

static VALUE
erb_escape_html(VALUE self, VALUE str)
{
    if (!RB_TYPE_P(str, T_STRING)) {
        str = rb_convert_type(str, T_STRING, "String", "to_s");
    }

    if (rb_enc_str_asciicompat_p(str)) {
        return optimized_escape_html(str);
    }
    else {
        return rb_funcall(rb_cCGI, id_escapeHTML, 1, str);
    }
}