Skip to content

Commit 662c480

Browse files
committed
[DOC] Tweaks for StringIO#external_encodiing
1 parent 3562c34 commit 662c480

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
@@ -2039,12 +2039,20 @@ strio_truncate(VALUE self, VALUE len)
20392039
}
20402040

20412041
/*
2042-
* call-seq:
2043-
* strio.external_encoding => encoding
2042+
* call-seq:
2043+
* external_encoding -> encoding or nil
2044+
*
2045+
* Returns an Encoding object that represents the encoding of the string;
2046+
* see {Encoding}[https://docs.ruby-lang.org/en/master/Encoding.html]:
2047+
*
2048+
* strio = StringIO.new('foo')
2049+
* strio.external_encoding # => #<Encoding:UTF-8>
2050+
*
2051+
* Returns +nil+ if +self+ has no string and is in write mode:
2052+
*
2053+
* strio = StringIO.new(nil, 'w+')
2054+
* strio.external_encoding # => nil
20442055
*
2045-
* Returns the Encoding object that represents the encoding of the file.
2046-
* If the stream is write mode and no encoding is specified, returns
2047-
* +nil+.
20482056
*/
20492057

20502058
static VALUE

0 commit comments

Comments
 (0)