@@ -649,13 +649,10 @@ strio_copy(VALUE copy, VALUE orig)
649649
650650/*
651651 * call-seq:
652- * strio. lineno -> integer
652+ * lineno -> current_line_number
653653 *
654- * Returns the current line number. The stream must be
655- * opened for reading. +lineno+ counts the number of times +gets+ is
656- * called, rather than the number of newlines encountered. The two
657- * values will differ if +gets+ is called with a separator other than
658- * newline. See also the <code>$.</code> variable.
654+ * Returns the current line number in +self+;
655+ * see {Line Number}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Line+Number].
659656 */
660657static VALUE
661658strio_get_lineno (VALUE self )
@@ -665,10 +662,10 @@ strio_get_lineno(VALUE self)
665662
666663/*
667664 * call-seq:
668- * strio. lineno = integer -> integer
665+ * lineno = new_line_number -> new_line_number
669666 *
670- * Manually sets the current line number to the given value.
671- * <code>$.</code> is updated only on the next read .
667+ * Sets the current line number in +self+ to the given +new_line_number+;
668+ * see {Line Number}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Line+Number] .
672669 */
673670static VALUE
674671strio_set_lineno (VALUE self , VALUE lineno )
@@ -679,9 +676,10 @@ strio_set_lineno(VALUE self, VALUE lineno)
679676
680677/*
681678 * call-seq:
682- * strio. binmode -> stringio
679+ * binmode -> self
683680 *
684- * Puts stream into binary mode. See IO#binmode.
681+ * Sets the data mode in +self+ to binary mode;
682+ * see {Data Mode}[https://docs.ruby-lang.org/en/master/File.html#class-File-label-Data+Mode].
685683 *
686684 */
687685static VALUE
@@ -705,11 +703,27 @@ strio_binmode(VALUE self)
705703
706704/*
707705 * call-seq:
708- * strio.reopen(other_StrIO) -> strio
709- * strio.reopen(string, mode) -> strio
706+ * reopen(other, mode = 'r+') -> self
707+ *
708+ * Reinitializes the stream with the given +other+ (string or StringIO) and +mode+;
709+ * see IO.new:
710+ *
711+ * StringIO.open('foo') do |strio|
712+ * p strio.string
713+ * strio.reopen('bar')
714+ * p strio.string
715+ * other_strio = StringIO.new('baz')
716+ * strio.reopen(other_strio)
717+ * p strio.string
718+ * other_strio.close
719+ * end
720+ *
721+ * Output:
722+ *
723+ * "foo"
724+ * "bar"
725+ * "baz"
710726 *
711- * Reinitializes the stream with the given <i>other_StrIO</i> or _string_
712- * and _mode_ (see StringIO#new).
713727 */
714728static VALUE
715729strio_reopen (int argc , VALUE * argv , VALUE self )
@@ -723,10 +737,12 @@ strio_reopen(int argc, VALUE *argv, VALUE self)
723737
724738/*
725739 * call-seq:
726- * strio.pos -> integer
727- * strio.tell -> integer
740+ * pos -> stream_position
741+ *
742+ * Returns the current position (in bytes);
743+ * see {Position}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Position].
728744 *
729- * Returns the current offset (in bytes) .
745+ * StringIO#tell is an alias for StringIO#pos .
730746 */
731747static VALUE
732748strio_get_pos (VALUE self )
@@ -736,9 +752,10 @@ strio_get_pos(VALUE self)
736752
737753/*
738754 * call-seq:
739- * strio. pos = integer -> integer
755+ * pos = new_position -> new_position
740756 *
741- * Seeks to the given position (in bytes).
757+ * Sets the current position (in bytes);
758+ * see {Position}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Position].
742759 */
743760static VALUE
744761strio_set_pos (VALUE self , VALUE pos )
@@ -754,10 +771,11 @@ strio_set_pos(VALUE self, VALUE pos)
754771
755772/*
756773 * call-seq:
757- * strio. rewind -> 0
774+ * rewind -> 0
758775 *
759- * Positions the stream to the beginning of input, resetting
760- * +lineno+ to zero.
776+ * Sets the current position and line number to zero;
777+ * see {Position}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Position]
778+ * and {Line Number}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Line+Number].
761779 */
762780static VALUE
763781strio_rewind (VALUE self )
@@ -770,10 +788,11 @@ strio_rewind(VALUE self)
770788
771789/*
772790 * call-seq:
773- * strio. seek(amount , whence= SEEK_SET) -> 0
791+ * seek(offset , whence = SEEK_SET) -> 0
774792 *
775- * Seeks to a given offset _amount_ in the stream according to
776- * the value of _whence_ (see IO#seek).
793+ * Sets the current position to the given integer +offset+ (in bytes),
794+ * with respect to a given constant +whence+;
795+ * see {Position}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Position].
777796 */
778797static VALUE
779798strio_seek (int argc , VALUE * argv , VALUE self )
@@ -809,9 +828,9 @@ strio_seek(int argc, VALUE *argv, VALUE self)
809828
810829/*
811830 * call-seq:
812- * strio. sync -> true
831+ * sync -> true
813832 *
814- * Returns +true+ always .
833+ * Returns +true+; implemented only for compatibility with other stream classes .
815834 */
816835static VALUE
817836strio_get_sync (VALUE self )
@@ -826,10 +845,12 @@ strio_get_sync(VALUE self)
826845
827846/*
828847 * call-seq:
829- * strio.each_byte {|byte| block } -> strio
830- * strio.each_byte -> anEnumerator
848+ * each_byte {|byte| ... } -> self
849+ *
850+ * With a block given, calls the block with each remaining byte in the stream;
851+ * see {Byte IO}[https://docs.ruby-lang.org/en/master/io_streams_rdoc.html#label-Byte+IO].
831852 *
832- * See IO#each_byte .
853+ * With no block given, returns an enumerator .
833854 */
834855static VALUE
835856strio_each_byte (VALUE self )
0 commit comments