Skip to content

Commit c3af7ea

Browse files
committed
Respond to reviews
1 parent 4b83858 commit c3af7ea

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

doc/stringio/stringio.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ similar in some ways to [class IO][io class].
33

44
You can create a \StringIO instance using:
55

6-
- StringIO.new(string): returns a new \StringIO object containing the given string.
7-
- StringIO.open(string): passes a new \StringIO object to the given block.
6+
- StringIO.new: returns a new \StringIO object containing the given string.
7+
- StringIO.open: passes a new \StringIO object to the given block.
88

99
Like an \IO stream, a \StringIO stream has certain properties:
1010

@@ -310,7 +310,8 @@ strio = StringIO.new('foo', 'rt')
310310
strio.external_encoding # => #<Encoding:UTF-8>
311311
data = "\u9990\u9991\u9992\u9993\u9994"
312312
strio = StringIO.new(data, 'rb')
313-
strio.external_encoding # => #<Encoding:BINARY (ASCII-8BIT)>```
313+
strio.external_encoding # => #<Encoding:BINARY (ASCII-8BIT)>
314+
```
314315

315316
When the data mode is specified, the read/write mode may not be omitted:
316317

@@ -360,9 +361,9 @@ The initial position of a stream is zero.
360361

361362
Each of these methods initializes (to zero) the position of a new or re-opened stream:
362363

363-
- ::new(string = '', mode = 'r+'): returns a new stream.
364-
- ::open(string = '', mode = 'r+'): passes a new stream to the block.
365-
- #reopen(string = '', mode = 'r+'): re-initializes the stream.
364+
- ::new: returns a new stream.
365+
- ::open: passes a new stream to the block.
366+
- #reopen: re-initializes the stream.
366367

367368
Each of these methods queries, gets, or sets the position, without otherwise changing the stream:
368369

@@ -429,9 +430,9 @@ strio.pos # => 47 ## End-of-stream.
429430
Each of these methods begins writing at the current position,
430431
and advances the position to the end of the written substring:
431432

432-
- #putc(character): writes a given character.
433+
- #putc: writes the given character.
433434
- #write: writes the given objects as strings.
434-
- [Kernel#puts][kernel#puts] writes given objects as strings, each followed by newline.
435+
- [Kernel#puts][kernel#puts]: writes given objects as strings, each followed by newline.
435436

436437
Examples:
437438

@@ -456,8 +457,8 @@ strio.pos # => 11
456457
Each of these methods writes _before_ the current position, and decrements the position
457458
so that the written data is next to be read:
458459

459-
- #ungetbyte(byte): unshifts the given byte.
460-
- #ungetc(character): unshifts the given character.
460+
- #ungetbyte: unshifts the given byte.
461+
- #ungetc: unshifts the given character.
461462

462463
Examples:
463464

@@ -474,7 +475,7 @@ strio.string # => "xxo"
474475

475476
This method does not affect the position:
476477

477-
- #truncate(size): truncates the stream's string to the given size.
478+
- #truncate: truncates the stream's string to the given size.
478479

479480
Examples:
480481

@@ -545,9 +546,9 @@ see [Read/Write Mode][read/write mode].
545546

546547
Each of these methods initializes the read/write mode for a new or re-opened stream:
547548

548-
- ::new(string = '', mode = 'r+'): returns a new stream.
549-
- ::open(string = '', mode = 'r+'): passes a new stream to the block.
550-
- #reopen(string = '', mode = 'r+'): re-initializes the stream.
549+
- ::new: returns a new stream.
550+
- ::open: passes a new stream to the block.
551+
- #reopen: re-initializes the stream.
551552

552553
Other relevant methods:
553554

@@ -624,29 +625,29 @@ This instance method is useful in a multi-threaded application:
624625

625626
You can write to the stream, advancing the position, using these instance methods:
626627

627-
- #putc(character): writes a given character.
628+
- #putc: writes a given character.
628629
- #write: writes the given objects as strings.
629630
- [Kernel#puts][kernel#puts] writes given objects as strings, each followed by newline.
630631

631632
You can "unshift" to the stream using these instance methods;
632633
each writes _before_ the current position, and decrements the position
633634
so that the written data is next to be read.
634635

635-
- #ungetbyte(byte): unshifts the given byte.
636-
- #ungetc(character): unshifts the given character.
636+
- #ungetbyte: unshifts the given byte.
637+
- #ungetc: unshifts the given character.
637638

638639
One more writing method:
639640

640-
- #truncate(size): truncates the stream's string to the given size.
641+
- #truncate: truncates the stream's string to the given size.
641642

642643
## Line \IO
643644

644645
Reading:
645646

646647
- #gets: reads and returns the next line.
647-
- #each_line: reads each remaining line, passing it to the block
648-
- #readlines: reads the remaining data the stream and returns an array of its lines.
649648
- [Kernel#readline][kernel#readline]: like #gets, but raises an exception if at end-of-stream.
649+
- #readlines: reads the remaining data the stream and returns an array of its lines.
650+
- #each_line: reads each remaining line, passing it to the block
650651

651652
Writing:
652653

0 commit comments

Comments
 (0)