Method: Regexp#encoding
- Defined in:
- encoding.c
#encoding ⇒ Encoding
Returns the Encoding object that represents the encoding of obj.
1162 1163 1164 1165 1166 1167 1168 1169 1170 |
# File 'encoding.c', line 1162
VALUE
rb_obj_encoding(VALUE obj)
{
int idx = rb_enc_get_index(obj);
if (idx < 0) {
rb_raise(rb_eTypeError, "unknown encoding");
}
return rb_enc_from_encoding_index(idx & ENC_INDEX_MASK);
}
|