Module: Hescape
- Defined in:
- lib/hescape.rb,
lib/hescape/version.rb,
ext/hescape/hescape.c
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Class Method Details
.escape_html ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'ext/hescape/hescape.c', line 167
static VALUE
rb_escape_html(RB_UNUSED_VAR(VALUE self), VALUE value)
{
char *buf;
unsigned int size;
VALUE str;
Check_Type(value, T_STRING);
str = rb_convert_type(value, T_STRING, "String", "to_s");
size = hesc_escape_html(&buf, RSTRING_PTR(str), RSTRING_LEN(str));
if (size > RSTRING_LEN(str)) {
str = rb_enc_str_new(buf, size, rb_utf8_encoding());
free((void *)buf);
}
return str;
}
|