@@ -649,13 +649,10 @@ strio_copy(VALUE copy, VALUE orig)
649
649
650
650
/*
651
651
* call-seq:
652
- * strio. lineno -> integer
652
+ * lineno -> current_line_number
653
653
*
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].
659
656
*/
660
657
static VALUE
661
658
strio_get_lineno (VALUE self )
@@ -665,10 +662,10 @@ strio_get_lineno(VALUE self)
665
662
666
663
/*
667
664
* call-seq:
668
- * strio. lineno = integer -> integer
665
+ * lineno = new_line_number -> new_line_number
669
666
*
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] .
672
669
*/
673
670
static VALUE
674
671
strio_set_lineno (VALUE self , VALUE lineno )
@@ -679,9 +676,10 @@ strio_set_lineno(VALUE self, VALUE lineno)
679
676
680
677
/*
681
678
* call-seq:
682
- * strio. binmode -> stringio
679
+ * binmode -> self
683
680
*
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].
685
683
*
686
684
*/
687
685
static VALUE
@@ -705,11 +703,27 @@ strio_binmode(VALUE self)
705
703
706
704
/*
707
705
* 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"
710
726
*
711
- * Reinitializes the stream with the given <i>other_StrIO</i> or _string_
712
- * and _mode_ (see StringIO#new).
713
727
*/
714
728
static VALUE
715
729
strio_reopen (int argc , VALUE * argv , VALUE self )
@@ -723,10 +737,12 @@ strio_reopen(int argc, VALUE *argv, VALUE self)
723
737
724
738
/*
725
739
* 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].
728
744
*
729
- * Returns the current offset (in bytes) .
745
+ * StringIO#tell is an alias for StringIO#pos .
730
746
*/
731
747
static VALUE
732
748
strio_get_pos (VALUE self )
@@ -736,9 +752,10 @@ strio_get_pos(VALUE self)
736
752
737
753
/*
738
754
* call-seq:
739
- * strio. pos = integer -> integer
755
+ * pos = new_position -> new_position
740
756
*
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].
742
759
*/
743
760
static VALUE
744
761
strio_set_pos (VALUE self , VALUE pos )
@@ -754,10 +771,11 @@ strio_set_pos(VALUE self, VALUE pos)
754
771
755
772
/*
756
773
* call-seq:
757
- * strio. rewind -> 0
774
+ * rewind -> 0
758
775
*
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].
761
779
*/
762
780
static VALUE
763
781
strio_rewind (VALUE self )
@@ -770,10 +788,11 @@ strio_rewind(VALUE self)
770
788
771
789
/*
772
790
* call-seq:
773
- * strio. seek(amount , whence= SEEK_SET) -> 0
791
+ * seek(offset , whence = SEEK_SET) -> 0
774
792
*
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].
777
796
*/
778
797
static VALUE
779
798
strio_seek (int argc , VALUE * argv , VALUE self )
@@ -809,9 +828,9 @@ strio_seek(int argc, VALUE *argv, VALUE self)
809
828
810
829
/*
811
830
* call-seq:
812
- * strio. sync -> true
831
+ * sync -> true
813
832
*
814
- * Returns +true+ always .
833
+ * Returns +true+; implemented only for compatibility with other stream classes .
815
834
*/
816
835
static VALUE
817
836
strio_get_sync (VALUE self )
@@ -826,10 +845,12 @@ strio_get_sync(VALUE self)
826
845
827
846
/*
828
847
* 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].
831
852
*
832
- * See IO#each_byte .
853
+ * With no block given, returns an enumerator .
833
854
*/
834
855
static VALUE
835
856
strio_each_byte (VALUE self )
0 commit comments