Method: StringIO#external_encoding

Defined in:
ext/stringio/stringio.c

#external_encodingEncoding

Returns the Encoding object that represents the encoding of the file. If the stream is write mode and no encoding is specified, returns nil.

Returns:

  • (Encoding)


1742
1743
1744
1745
1746
1747
# File 'ext/stringio/stringio.c', line 1742

static VALUE
strio_external_encoding(VALUE self)
{
    struct StringIO *ptr = StringIO(self);
    return rb_enc_from_encoding(get_enc(ptr));
}