summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2025-12-06 17:20:13 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-12-10 15:17:09 +0900
commit5bc65db5550719a808858af361d5152931469c88 (patch)
treef9f0c653dc62089243c28530210a1999f836223e /doc
parentf623fcc7d069cdfcaf25285c986ed995530a686f (diff)
[ruby/stringio] [DOC] Tweaks for StringIO#gets
(https://github.com/ruby/stringio/pull/190) https://github.com/ruby/stringio/commit/77209fac20
Diffstat (limited to 'doc')
-rw-r--r--doc/stringio/gets.rdoc19
1 files changed, 10 insertions, 9 deletions
diff --git a/doc/stringio/gets.rdoc b/doc/stringio/gets.rdoc
index 892c3feb53..bbefeb008a 100644
--- a/doc/stringio/gets.rdoc
+++ b/doc/stringio/gets.rdoc
@@ -19,10 +19,10 @@ With no arguments given, reads a line using the default record separator
strio.eof? # => true
strio.gets # => nil
- strio = StringIO.new('тест') # Four 2-byte characters.
+ strio = StringIO.new('Привет') # Six 2-byte characters
strio.pos # => 0
- strio.gets # => "тест"
- strio.pos # => 8
+ strio.gets # => "Привет"
+ strio.pos # => 12
<b>Argument +sep+</b>
@@ -67,11 +67,11 @@ but in other cases the position may be anywhere:
The position need not be at a character boundary:
- strio = StringIO.new('тест') # Four 2-byte characters.
- strio.pos = 2 # At beginning of second character.
- strio.gets # => "ест"
- strio.pos = 3 # In middle of second character.
- strio.gets # => "\xB5ст"
+ strio = StringIO.new('Привет') # Six 2-byte characters.
+ strio.pos = 2 # At beginning of second character.
+ strio.gets # => "ривет"
+ strio.pos = 3 # In middle of second character.
+ strio.gets # => "\x80ивет"
<b>Special Record Separators</b>
@@ -95,4 +95,5 @@ removes the trailing newline (if any) from the returned line:
strio.gets # => "First line\n"
strio.gets(chomp: true) # => "Second line"
-Related: StringIO.each_line.
+Related: #each_line, #readlines,
+{Kernel#puts}[rdoc-ref:Kernel#puts].