123456789_123456789_123456789_123456789_123456789_

Module: CGI::Escape

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Defined in: ext/cgi/escape/escape.c

Instance Method Summary

Instance Method Details

CGI.escape(string) ⇒ String

Returns URL-escaped string.

[ GitHub ]

  
# File 'ext/cgi/escape/escape.c', line 359

static VALUE
cgiesc_escape(VALUE self, VALUE str)
{
    StringValue(str);

    if (rb_enc_str_asciicompat_p(str)) {
	return optimized_escape(str);
    }
    else {
	return rb_call_super(1, &str);
    }
}

CGI.escapeHTML(string) ⇒ String

Returns HTML-escaped string.

[ GitHub ]

  
# File 'ext/cgi/escape/escape.c', line 319

static VALUE
cgiesc_escape_html(VALUE self, VALUE str)
{
    StringValue(str);

    if (rb_enc_str_asciicompat_p(str)) {
	return optimized_escape_html(str);
    }
    else {
	return rb_call_super(1, &str);
    }
}

CGI.unescape(string, encoding = @@accept_charset) ⇒ String

Returns URL-unescaped string.

[ GitHub ]

  
# File 'ext/cgi/escape/escape.c', line 387

static VALUE
cgiesc_unescape(int argc, VALUE *argv, VALUE self)
{
    VALUE str = (rb_check_arity(argc, 1, 2), argv[0]);

    StringValue(str);

    if (rb_enc_str_asciicompat_p(str)) {
	VALUE enc = accept_charset(argc-1, argv+1, self);
	return optimized_unescape(str, enc);
    }
    else {
	return rb_call_super(argc, argv);
    }
}

CGI.unescapeHTML(string) ⇒ String

Returns HTML-unescaped string.

[ GitHub ]

  
# File 'ext/cgi/escape/escape.c', line 339

static VALUE
cgiesc_unescape_html(VALUE self, VALUE str)
{
    StringValue(str);

    if (rb_enc_str_asciicompat_p(str)) {
	return optimized_unescape_html(str);
    }
    else {
	return rb_call_super(1, &str);
    }
}