seek

ARGF.seek(amount, whence=IO::SEEK_SET) â 0 Instance Public methods Seeks to offset amount (an Integer) in the ARGF stream according to the value of whence. See +IO#seek+ for further details.

rewind

ARGF.rewind â 0 Instance Public methods Positions the current file to the beginning of input, resetting ARGF.lineno to zero. ARGF.readline #=> "This is line one\n" ARGF.rewind #=> 0 ARGF.lineno #=> 0 ARGF.readline #=> "This is line one\n"

readpartial

ARGF.readpartial(maxlen) â stringARGF.readpartial(maxlen, outbuf) â outbuf Instance Public methods Reads at most maxlen bytes from the ARGF stream. It blocks only if ARGF has no data immediately available. If the optional outbuf argument is present, it must reference a String, which will receive the data. The outbuf will contain only the received data after the method call even if it is not empty at the beginning. It raises EOFError on end of file. readpartial is

readlines

ARGF.readlines(sep=$/) â arrayARGF.readlines(limit) â arrayARGF.readlines(sep, limit) â array Instance Public methods Reads ARGF's current file in its entirety, returning an Array of its lines, one line per element. Lines are assumed to be separated by sep. lines = ARGF.readlines lines[0] #=> "This is line one\n"

readline

ARGF.readline(sep=$/) â stringARGF.readline(limit) â stringARGF.readline(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. An EOFError is raised at the end of the

readchar

ARGF.readchar â String or nil Instance Public methods Reads the next character from ARGF and returns it as a String. Raises an EOFError after the last character of the last file has been read. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.readchar #=> "f" ARGF.readchar #=> "o" ARGF.readchar #=> "o" ARGF.readchar #=> "\n" ARGF.readchar #=> end of file reached (EOFError)

readbyte

ARGF.readbyte â Fixnum Instance Public methods Reads the next 8-bit byte from ARGF and returns it as a Fixnum. Raises an EOFError after the last byte of the last file has been read. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.readbyte #=> 102 ARGF.readbyte #=> 111 ARGF.readbyte #=> 111 ARGF.readbyte #=> 10 ARGF.readbyte #=> end of file reached (EOFError)

read_nonblock

ARGF.read_nonblock(maxlen) â stringARGF.read_nonblock(maxlen, outbuf) â outbuf Instance Public methods Reads at most maxlen bytes from the ARGF stream in non-blocking mode.

read

ARGF.read([length [, outbuf]]) â string, outbuf, or nil Instance Public methods Reads _length_ bytes from ARGF. The files named on the command line are concatenated and treated as a single file by this method, so when called without arguments the contents of this pseudo file are returned in their entirety. _length_ must be a non-negative integer or nil. If it is a positive integer, +read+ tries to read at most _length_ bytes. It returns nil if an EOF was encountered before any

puts

ios.puts(obj, ...) â nil Instance Public methods Writes the given objects to ios as with IO#print. Writes a record separator (typically a newline) after any that do not already end with a newline sequence. If called with an array argument, writes each element on a new line. If called without arguments, outputs a single record separator. $stdout.puts("this", "is", "a", "test") produces: this is a test