eof

ARGF.eof? â true or falseARGF.eof â true or false Instance Public methods Returns true if the current file in ARGF is at end of file, i.e. it has no data to read. The stream must be opened for reading or an IOError will be raised. $ echo "eof" | ruby argf.rb ARGF.eof? #=> false 3.times { ARGF.readchar } ARGF.eof? #=> false ARGF.readchar #=> "\n" ARGF.eof? #=> true

eof?

ARGF.eof? â true or false Instance Public methods Returns true if the current file in ARGF is at end of file, i.e. it has no data to read. The stream must be opened for reading or an IOError will be raised. $ echo "eof" | ruby argf.rb ARGF.eof? #=> false 3.times { ARGF.readchar } ARGF.eof? #=> false ARGF.readchar #=> "\n" ARGF.eof? #=> true

external_encoding

ARGF.external_encoding â encoding Instance Public methods Returns the external encoding for files read from +ARGF+ as an +Encoding+ object. The external encoding is the encoding of the text as stored in a file. Contrast with +ARGF.internal_encoding+, which is the encoding used to represent this text within Ruby. To set the external encoding use +ARGF.set_encoding+. For example: ARGF.external_encoding #=> #<Encoding:UTF-8>

file

ARGF.file â IO or File object Instance Public methods Returns the current file as an IO or File object. #<IO:<STDIN>> is returned when the current file is STDIN. For example: $ echo "foo" > foo $ echo "bar" > bar $ ruby argf.rb foo bar ARGF.file #=> #<File:foo> ARGF.read(5) #=> "foo\nb" ARGF.file #=> #<File:bar>

filename

ARGF.filename â String Instance Public methods Returns the current filename. â-â is returned when the current file is STDIN. For example: $ echo "foo" > foo $ echo "bar" > bar $ echo "glark" > glark $ ruby argf.rb foo bar glark ARGF.filename #=> "foo" ARGF.read(5) #=> "foo\nb" ARGF.filename #=> "bar" ARGF.skip ARGF.filename #=> "glark"

fileno

ARGF.fileno â fixnum Instance Public methods Returns an integer representing the numeric file descriptor for the current file. Raises an ArgumentError if there isn't a current file. ARGF.fileno #=> 3

getbyte

ARGF.getbyte â Fixnum or nil Instance Public methods Gets the next 8-bit byte (0..255) from ARGF. Returns nil if called at the end of the stream. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.getbyte #=> 102 ARGF.getbyte #=> 111 ARGF.getbyte #=> 111 ARGF.getbyte #=> 10 ARGF.getbyte #=> nil

getc

ARGF.getc â String or nil Instance Public methods Reads the next character from ARGF and returns it as a String. Returns nil at the end of the stream. ARGF treats the files named on the command line as a single file created by concatenating their contents. After returning the last character of the first file, it returns the first character of the second file, and so on. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.getc #=> "f" ARGF.getc #=> "o" ARGF.getc

gets

ARGF.gets(sep=$/) â stringARGF.gets(limit) â stringARGF.gets(sep, limit) â string Instance Public methods Returns the next line from the current file in ARGF. By default lines are assumed to be separated by +$/+; to use a different character as a separator, supply it as a String for the sep argument. The optional limit argument specifies how many characters of each line to return. By default all characters are returned.

inplace_mode

ARGF.inplace_mode â String Instance Public methods Returns the file extension appended to the names of modified files under inplace-edit mode. This value can be set using ARGF.inplace_mode= or passing the -i switch to the Ruby binary.