Skip to content

Commit 77209fa

Browse files
[DOC] Tweaks for StringIO#gets (#190)
1 parent 66360ee commit 77209fa

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

doc/stringio/gets.rdoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ With no arguments given, reads a line using the default record separator
1919
strio.eof? # => true
2020
strio.gets # => nil
2121

22-
strio = StringIO.new('тест') # Four 2-byte characters.
22+
strio = StringIO.new('Привет') # Six 2-byte characters
2323
strio.pos # => 0
24-
strio.gets # => "тест"
25-
strio.pos # => 8
24+
strio.gets # => "Привет"
25+
strio.pos # => 12
2626

2727
<b>Argument +sep+</b>
2828

@@ -67,11 +67,11 @@ but in other cases the position may be anywhere:
6767

6868
The position need not be at a character boundary:
6969

70-
strio = StringIO.new('тест') # Four 2-byte characters.
71-
strio.pos = 2 # At beginning of second character.
72-
strio.gets # => "ест"
73-
strio.pos = 3 # In middle of second character.
74-
strio.gets # => "\xB5ст"
70+
strio = StringIO.new('Привет') # Six 2-byte characters.
71+
strio.pos = 2 # At beginning of second character.
72+
strio.gets # => "ривет"
73+
strio.pos = 3 # In middle of second character.
74+
strio.gets # => "\x80ивет"
7575

7676
<b>Special Record Separators</b>
7777

@@ -95,4 +95,5 @@ removes the trailing newline (if any) from the returned line:
9595
strio.gets # => "First line\n"
9696
strio.gets(chomp: true) # => "Second line"
9797

98-
Related: StringIO.each_line.
98+
Related: #each_line, #readlines,
99+
{Kernel#puts}[https://docs.ruby-lang.org/en/master/Kernel.html#method-i-puts].

0 commit comments

Comments
 (0)