Skip to content

Commit 431fdc9

Browse files
committed
[DOC] Cross references for ARGF
1 parent 4ad6989 commit 431fdc9

File tree

1 file changed

+61
-61
lines changed

1 file changed

+61
-61
lines changed

io.c

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9571,11 +9571,11 @@ argf_initialize_copy(VALUE argf, VALUE orig)
95719571
* call-seq:
95729572
* ARGF.lineno = integer -> integer
95739573
*
9574-
* Sets the line number of +ARGF+ as a whole to the given +Integer+.
9574+
* Sets the line number of ARGF as a whole to the given Integer.
95759575
*
9576-
* +ARGF+ sets the line number automatically as you read data, so normally
9576+
* ARGF sets the line number automatically as you read data, so normally
95779577
* you will not need to set it explicitly. To access the current line number
9578-
* use +ARGF.lineno+.
9578+
* use ARGF.lineno.
95799579
*
95809580
* For example:
95819581
*
@@ -9598,7 +9598,7 @@ argf_set_lineno(VALUE argf, VALUE val)
95989598
* ARGF.lineno -> integer
95999599
*
96009600
* Returns the current line number of ARGF as a whole. This value
9601-
* can be set manually with +ARGF.lineno=+.
9601+
* can be set manually with ARGF.lineno=.
96029602
*
96039603
* For example:
96049604
*
@@ -9923,10 +9923,10 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
99239923
* ARGF.gets(limit [, getline_args]) -> string or nil
99249924
* ARGF.gets(sep, limit [, getline_args]) -> string or nil
99259925
*
9926-
* Returns the next line from the current file in +ARGF+.
9926+
* Returns the next line from the current file in ARGF.
99279927
*
99289928
* By default lines are assumed to be separated by <code>$/</code>;
9929-
* to use a different character as a separator, supply it as a +String+
9929+
* to use a different character as a separator, supply it as a String
99309930
* for the _sep_ argument.
99319931
*
99329932
* The optional _limit_ argument specifies how many characters of each line
@@ -10005,16 +10005,16 @@ rb_f_readline(int argc, VALUE *argv, VALUE recv)
1000510005
* ARGF.readline(limit) -> string
1000610006
* ARGF.readline(sep, limit) -> string
1000710007
*
10008-
* Returns the next line from the current file in +ARGF+.
10008+
* Returns the next line from the current file in ARGF.
1000910009
*
1001010010
* By default lines are assumed to be separated by <code>$/</code>;
10011-
* to use a different character as a separator, supply it as a +String+
10011+
* to use a different character as a separator, supply it as a String
1001210012
* for the _sep_ argument.
1001310013
*
1001410014
* The optional _limit_ argument specifies how many characters of each line
1001510015
* to return. By default all characters are returned.
1001610016
*
10017-
* An +EOFError+ is raised at the end of the file.
10017+
* An EOFError is raised at the end of the file.
1001810018
*/
1001910019
static VALUE
1002010020
argf_readline(int argc, VALUE *argv, VALUE argf)
@@ -10111,7 +10111,7 @@ rb_f_readlines(int argc, VALUE *argv, VALUE recv)
1011110111
* ARGF.to_a(limit) -> array
1011210112
* ARGF.to_a(sep, limit) -> array
1011310113
*
10114-
* Reads each file in +ARGF+ in its entirety, returning an +Array+ containing
10114+
* Reads each file in ARGF in its entirety, returning an Array containing
1011510115
* lines from the files. Lines are assumed to be separated by _sep_.
1011610116
*
1011710117
* lines = ARGF.readlines
@@ -13126,12 +13126,12 @@ global_argf_p(VALUE arg)
1312613126
* call-seq:
1312713127
* ARGF.external_encoding -> encoding
1312813128
*
13129-
* Returns the external encoding for files read from +ARGF+ as an +Encoding+
13129+
* Returns the external encoding for files read from ARGF as an Encoding
1313013130
* object. The external encoding is the encoding of the text as stored in a
13131-
* file. Contrast with +ARGF.internal_encoding+, which is the encoding used
13132-
* to represent this text within Ruby.
13131+
* file. Contrast with ARGF.internal_encoding, which is the encoding used to
13132+
* represent this text within Ruby.
1313313133
*
13134-
* To set the external encoding use +ARGF.set_encoding+.
13134+
* To set the external encoding use ARGF.set_encoding.
1313513135
*
1313613136
* For example:
1313713137
*
@@ -13151,10 +13151,10 @@ argf_external_encoding(VALUE argf)
1315113151
* call-seq:
1315213152
* ARGF.internal_encoding -> encoding
1315313153
*
13154-
* Returns the internal encoding for strings read from +ARGF+ as an
13155-
* +Encoding+ object.
13154+
* Returns the internal encoding for strings read from ARGF as an
13155+
* Encoding object.
1315613156
*
13157-
* If +ARGF.set_encoding+ has been called with two encoding names, the second
13157+
* If ARGF.set_encoding has been called with two encoding names, the second
1315813158
* is returned. Otherwise, if +Encoding.default_external+ has been set, that
1315913159
* value is returned. Failing that, if a default external encoding was
1316013160
* specified on the command-line, that value is used. If the encoding is
@@ -13190,7 +13190,7 @@ argf_internal_encoding(VALUE argf)
1319013190
* specifies the internal encoding.
1319113191
*
1319213192
* If the external encoding and the internal encoding are specified, the
13193-
* optional +Hash+ argument can be used to adjust the conversion process. The
13193+
* optional Hash argument can be used to adjust the conversion process. The
1319413194
* structure of this hash is explained in the String#encode documentation.
1319513195
*
1319613196
* For example:
@@ -13219,7 +13219,7 @@ argf_set_encoding(int argc, VALUE *argv, VALUE argf)
1321913219
* ARGF.tell -> Integer
1322013220
* ARGF.pos -> Integer
1322113221
*
13222-
* Returns the current offset (in bytes) of the current file in +ARGF+.
13222+
* Returns the current offset (in bytes) of the current file in ARGF.
1322313223
*
1322413224
* ARGF.pos #=> 0
1322513225
* ARGF.gets #=> "This is line one\n"
@@ -13240,7 +13240,7 @@ argf_tell(VALUE argf)
1324013240
* call-seq:
1324113241
* ARGF.seek(amount, whence=IO::SEEK_SET) -> 0
1324213242
*
13243-
* Seeks to offset _amount_ (an +Integer+) in the +ARGF+ stream according to
13243+
* Seeks to offset _amount_ (an Integer) in the ARGF stream according to
1324413244
* the value of _whence_. See IO#seek for further details.
1324513245
*/
1324613246
static VALUE
@@ -13257,7 +13257,7 @@ argf_seek_m(int argc, VALUE *argv, VALUE argf)
1325713257
* call-seq:
1325813258
* ARGF.pos = position -> Integer
1325913259
*
13260-
* Seeks to the position given by _position_ (in bytes) in +ARGF+.
13260+
* Seeks to the position given by _position_ (in bytes) in ARGF.
1326113261
*
1326213262
* For example:
1326313263
*
@@ -13279,7 +13279,7 @@ argf_set_pos(VALUE argf, VALUE offset)
1327913279
* ARGF.rewind -> 0
1328013280
*
1328113281
* Positions the current file to the beginning of input, resetting
13282-
* +ARGF.lineno+ to zero.
13282+
* ARGF.lineno to zero.
1328313283
*
1328413284
* ARGF.readline #=> "This is line one\n"
1328513285
* ARGF.rewind #=> 0
@@ -13310,7 +13310,7 @@ argf_rewind(VALUE argf)
1331013310
* ARGF.to_i -> integer
1331113311
*
1331213312
* Returns an integer representing the numeric file descriptor for
13313-
* the current file. Raises an +ArgumentError+ if there isn't a current file.
13313+
* the current file. Raises an ArgumentError if there isn't a current file.
1331413314
*
1331513315
* ARGF.fileno #=> 3
1331613316
*/
@@ -13328,8 +13328,8 @@ argf_fileno(VALUE argf)
1332813328
* call-seq:
1332913329
* ARGF.to_io -> IO
1333013330
*
13331-
* Returns an +IO+ object representing the current file. This will be a
13332-
* +File+ object unless the current file is a stream such as STDIN.
13331+
* Returns an IO object representing the current file. This will be a
13332+
* File object unless the current file is a stream such as STDIN.
1333313333
*
1333413334
* For example:
1333513335
*
@@ -13349,8 +13349,8 @@ argf_to_io(VALUE argf)
1334913349
* ARGF.eof? -> true or false
1335013350
* ARGF.eof -> true or false
1335113351
*
13352-
* Returns true if the current file in +ARGF+ is at end of file, i.e. it has
13353-
* no data to read. The stream must be opened for reading or an +IOError+
13352+
* Returns true if the current file in ARGF is at end of file, i.e. it has
13353+
* no data to read. The stream must be opened for reading or an IOError
1335413354
* will be raised.
1335513355
*
1335613356
* $ echo "eof" | ruby argf.rb
@@ -13585,10 +13585,10 @@ argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts, int nonblock)
1358513585
* call-seq:
1358613586
* ARGF.getc -> String or nil
1358713587
*
13588-
* Reads the next character from +ARGF+ and returns it as a +String+. Returns
13588+
* Reads the next character from ARGF and returns it as a String. Returns
1358913589
* +nil+ at the end of the stream.
1359013590
*
13591-
* +ARGF+ treats the files named on the command line as a single file created
13591+
* ARGF treats the files named on the command line as a single file created
1359213592
* by concatenating their contents. After returning the last character of the
1359313593
* first file, it returns the first character of the second file, and so on.
1359413594
*
@@ -13630,7 +13630,7 @@ argf_getc(VALUE argf)
1363013630
* call-seq:
1363113631
* ARGF.getbyte -> Integer or nil
1363213632
*
13633-
* Gets the next 8-bit byte (0..255) from +ARGF+. Returns +nil+ if called at
13633+
* Gets the next 8-bit byte (0..255) from ARGF. Returns +nil+ if called at
1363413634
* the end of the stream.
1363513635
*
1363613636
* For example:
@@ -13670,8 +13670,8 @@ argf_getbyte(VALUE argf)
1367013670
* call-seq:
1367113671
* ARGF.readchar -> String or nil
1367213672
*
13673-
* Reads the next character from +ARGF+ and returns it as a +String+. Raises
13674-
* an +EOFError+ after the last character of the last file has been read.
13673+
* Reads the next character from ARGF and returns it as a String. Raises
13674+
* an EOFError after the last character of the last file has been read.
1367513675
*
1367613676
* For example:
1367713677
*
@@ -13710,8 +13710,8 @@ argf_readchar(VALUE argf)
1371013710
* call-seq:
1371113711
* ARGF.readbyte -> Integer
1371213712
*
13713-
* Reads the next 8-bit byte from ARGF and returns it as an +Integer+. Raises
13714-
* an +EOFError+ after the last byte of the last file has been read.
13713+
* Reads the next 8-bit byte from ARGF and returns it as an Integer. Raises
13714+
* an EOFError after the last byte of the last file has been read.
1371513715
*
1371613716
* For example:
1371713717
*
@@ -13791,15 +13791,15 @@ argf_block_call_line(ID mid, int argc, VALUE *argv, VALUE argf)
1379113791
* which defaults to your platform's newline character) of each file in
1379213792
* +ARGV+. If a block is supplied, each line in turn will be yielded to the
1379313793
* block, otherwise an enumerator is returned.
13794-
* The optional _limit_ argument is an +Integer+ specifying the maximum
13794+
* The optional _limit_ argument is an Integer specifying the maximum
1379513795
* length of each line; longer lines will be split according to this limit.
1379613796
*
1379713797
* This method allows you to treat the files supplied on the command line as
1379813798
* a single file consisting of the concatenation of each named file. After
1379913799
* the last line of the first file has been returned, the first line of the
13800-
* second file is returned. The +ARGF.filename+ and +ARGF.lineno+ methods can
13801-
* be used to determine the filename of the current line and line number of
13802-
* the whole input, respectively.
13800+
* second file is returned. The ARGF.filename and ARGF.lineno methods can be
13801+
* used to determine the filename of the current line and line number of the
13802+
* whole input, respectively.
1380313803
*
1380413804
* For example, the following code prints out each line of each named file
1380513805
* prefixed with its line number, displaying the filename once per file:
@@ -13833,12 +13833,12 @@ argf_each_line(int argc, VALUE *argv, VALUE argf)
1383313833
* ARGF.each_byte -> an_enumerator
1383413834
*
1383513835
* Iterates over each byte of each file in +ARGV+.
13836-
* A byte is returned as an +Integer+ in the range 0..255.
13836+
* A byte is returned as an Integer in the range 0..255.
1383713837
*
1383813838
* This method allows you to treat the files supplied on the command line as
1383913839
* a single file consisting of the concatenation of each named file. After
1384013840
* the last byte of the first file has been returned, the first byte of the
13841-
* second file is returned. The +ARGF.filename+ method can be used to
13841+
* second file is returned. The ARGF.filename method can be used to
1384213842
* determine the filename of the current byte.
1384313843
*
1384413844
* If no block is given, an enumerator is returned instead.
@@ -13863,12 +13863,12 @@ argf_each_byte(VALUE argf)
1386313863
* ARGF.each_char {|char| block } -> ARGF
1386413864
* ARGF.each_char -> an_enumerator
1386513865
*
13866-
* Iterates over each character of each file in +ARGF+.
13866+
* Iterates over each character of each file in ARGF.
1386713867
*
1386813868
* This method allows you to treat the files supplied on the command line as
1386913869
* a single file consisting of the concatenation of each named file. After
1387013870
* the last character of the first file has been returned, the first
13871-
* character of the second file is returned. The +ARGF.filename+ method can
13871+
* character of the second file is returned. The ARGF.filename method can
1387213872
* be used to determine the name of the file in which the current character
1387313873
* appears.
1387413874
*
@@ -13889,12 +13889,12 @@ argf_each_char(VALUE argf)
1388913889
* ARGF.each_codepoint {|codepoint| block } -> ARGF
1389013890
* ARGF.each_codepoint -> an_enumerator
1389113891
*
13892-
* Iterates over each codepoint of each file in +ARGF+.
13892+
* Iterates over each codepoint of each file in ARGF.
1389313893
*
1389413894
* This method allows you to treat the files supplied on the command line as
1389513895
* a single file consisting of the concatenation of each named file. After
1389613896
* the last codepoint of the first file has been returned, the first
13897-
* codepoint of the second file is returned. The +ARGF.filename+ method can
13897+
* codepoint of the second file is returned. The ARGF.filename method can
1389813898
* be used to determine the name of the file in which the current codepoint
1389913899
* appears.
1390013900
*
@@ -13949,7 +13949,7 @@ argf_filename_getter(ID id, VALUE *var)
1394913949
* call-seq:
1395013950
* ARGF.file -> IO or File object
1395113951
*
13952-
* Returns the current file as an +IO+ or +File+ object.
13952+
* Returns the current file as an IO or File object.
1395313953
* <code>$stdin</code> is returned when the current file is STDIN.
1395413954
*
1395513955
* For example:
@@ -13974,7 +13974,7 @@ argf_file(VALUE argf)
1397413974
* call-seq:
1397513975
* ARGF.binmode -> ARGF
1397613976
*
13977-
* Puts +ARGF+ into binary mode. Once a stream is in binary mode, it cannot
13977+
* Puts ARGF into binary mode. Once a stream is in binary mode, it cannot
1397813978
* be reset to non-binary mode. This option has the following effects:
1397913979
*
1398013980
* * Newline conversion is disabled.
@@ -13995,8 +13995,8 @@ argf_binmode_m(VALUE argf)
1399513995
* call-seq:
1399613996
* ARGF.binmode? -> true or false
1399713997
*
13998-
* Returns true if +ARGF+ is being read in binary mode; false otherwise.
13999-
* To enable binary mode use +ARGF.binmode+.
13998+
* Returns true if ARGF is being read in binary mode; false otherwise.
13999+
* To enable binary mode use ARGF.binmode.
1400014000
*
1400114001
* For example:
1400214002
*
@@ -14039,7 +14039,7 @@ argf_skip(VALUE argf)
1403914039
* ARGF.close -> ARGF
1404014040
*
1404114041
* Closes the current file and skips to the next file in ARGV. If there are
14042-
* no more files to open, just closes the current file. +STDIN+ will not be
14042+
* no more files to open, just closes the current file. STDIN will not be
1404314043
* closed.
1404414044
*
1404514045
* For example:
@@ -14068,7 +14068,7 @@ argf_close_m(VALUE argf)
1406814068
* ARGF.closed? -> true or false
1406914069
*
1407014070
* Returns _true_ if the current file has been closed; _false_ otherwise. Use
14071-
* +ARGF.close+ to actually close the current file.
14071+
* ARGF.close to actually close the current file.
1407214072
*/
1407314073
static VALUE
1407414074
argf_closed(VALUE argf)
@@ -14096,7 +14096,7 @@ argf_to_s(VALUE argf)
1409614096
*
1409714097
* Returns the file extension appended to the names of backup copies of
1409814098
* modified files under in-place edit mode. This value can be set using
14099-
* +ARGF.inplace_mode=+ or passing the +-i+ switch to the Ruby binary.
14099+
* ARGF.inplace_mode= or passing the +-i+ switch to the Ruby binary.
1410014100
*/
1410114101
static VALUE
1410214102
argf_inplace_mode_get(VALUE argf)
@@ -14309,9 +14309,9 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
1430914309
* methods exist in two forms,
1431014310
*
1431114311
* one that returns +nil+ when the end of file is reached, the other
14312-
* raises +EOFError+.
14312+
* raises EOFError.
1431314313
*
14314-
* +EOFError+ is a subclass of +IOError+.
14314+
* EOFError is a subclass of IOError.
1431514315
*
1431614316
* file = File.open("/etc/hosts")
1431714317
* file.read
@@ -14323,11 +14323,11 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
1432314323
/*
1432414324
* Document-class: ARGF
1432514325
*
14326-
* +ARGF+ is a stream designed for use in scripts that process files given as
14326+
* ARGF is a stream designed for use in scripts that process files given as
1432714327
* command-line arguments or passed in via STDIN.
1432814328
*
1432914329
* The arguments passed to your script are stored in the +ARGV+ Array, one
14330-
* argument per element. +ARGF+ assumes that any arguments that aren't
14330+
* argument per element. ARGF assumes that any arguments that aren't
1433114331
* filenames have been removed from +ARGV+. For example:
1433214332
*
1433314333
* $ ruby argf.rb --verbose file1 file2
@@ -14336,15 +14336,15 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
1433614336
* option = ARGV.shift #=> "--verbose"
1433714337
* ARGV #=> ["file1", "file2"]
1433814338
*
14339-
* You can now use +ARGF+ to work with a concatenation of each of these named
14340-
* files. For instance, +ARGF.read+ will return the contents of _file1_
14339+
* You can now use ARGF to work with a concatenation of each of these named
14340+
* files. For instance, ARGF.read will return the contents of _file1_
1434114341
* followed by the contents of _file2_.
1434214342
*
14343-
* After a file in +ARGV+ has been read +ARGF+ removes it from the Array.
14343+
* After a file in +ARGV+ has been read ARGF removes it from the Array.
1434414344
* Thus, after all files have been read +ARGV+ will be empty.
1434514345
*
14346-
* You can manipulate +ARGV+ yourself to control what +ARGF+ operates on. If
14347-
* you remove a file from +ARGV+, it is ignored by +ARGF+; if you add files to
14346+
* You can manipulate +ARGV+ yourself to control what ARGF operates on. If
14347+
* you remove a file from +ARGV+, it is ignored by ARGF; if you add files to
1434814348
* +ARGV+, they are treated as if they were named on the command line. For
1434914349
* example:
1435014350
*
@@ -14354,7 +14354,7 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
1435414354
* ARGV.replace ["file2", "file3"]
1435514355
* ARGF.read # Returns the contents of file2 and file3
1435614356
*
14357-
* If +ARGV+ is empty, +ARGF+ acts as if it contained STDIN, i.e. the data
14357+
* If +ARGV+ is empty, ARGF acts as if it contained STDIN, i.e. the data
1435814358
* piped to your script. For example:
1435914359
*
1436014360
* $ echo "glark" | ruby -e 'p ARGF.read'

0 commit comments

Comments
 (0)