Method: String#encoding
- Defined in:
- encoding.c
permalink #encoding ⇒ Encoding
Returns the Encoding object that represents the encoding of obj.
1201 1202 1203 1204 1205 1206 1207 1208 1209 |
# File 'encoding.c', line 1201
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);
}
|