Skip to content

Commit 92656f5

Browse files
[DOC] Tweaks for StringIO#external_encoding (#161)
1 parent 5034156 commit 92656f5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

ext/stringio/stringio.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,12 +2047,20 @@ strio_truncate(VALUE self, VALUE len)
20472047
}
20482048

20492049
/*
2050-
* call-seq:
2051-
* strio.external_encoding => encoding
2050+
* call-seq:
2051+
* external_encoding -> encoding or nil
2052+
*
2053+
* Returns an Encoding object that represents the encoding of the string;
2054+
* see {Encoding}[https://docs.ruby-lang.org/en/master/Encoding.html]:
2055+
*
2056+
* strio = StringIO.new('foo')
2057+
* strio.external_encoding # => #<Encoding:UTF-8>
2058+
*
2059+
* Returns +nil+ if +self+ has no string and is in write mode:
2060+
*
2061+
* strio = StringIO.new(nil, 'w+')
2062+
* strio.external_encoding # => nil
20522063
*
2053-
* Returns the Encoding object that represents the encoding of the file.
2054-
* If the stream is write mode and no encoding is specified, returns
2055-
* +nil+.
20562064
*/
20572065

20582066
static VALUE

0 commit comments

Comments
 (0)