diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 874a3a1b..f5eb62b6 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -2039,12 +2039,20 @@ strio_truncate(VALUE self, VALUE len) } /* - * call-seq: - * strio.external_encoding => encoding + * call-seq: + * external_encoding -> encoding or nil + * + * Returns an Encoding object that represents the encoding of the string; + * see {Encoding}[https://docs.ruby-lang.org/en/master/Encoding.html]: + * + * strio = StringIO.new('foo') + * strio.external_encoding # => # + * + * Returns +nil+ if +self+ has no string and is in write mode: + * + * strio = StringIO.new(nil, 'w+') + * strio.external_encoding # => nil * - * Returns the Encoding object that represents the encoding of the file. - * If the stream is write mode and no encoding is specified, returns - * +nil+. */ static VALUE