inplace_mode=

ARGF.inplace_mode = ext â ARGF Instance Public methods Sets the filename extension for inplace editing mode to the given String. Each file being edited has this value appended to its filename. The modified file is saved under this new name. For example: $ ruby argf.rb file.txt ARGF.inplace_mode = '.bak' ARGF.lines do |line| print line.sub("foo","bar") end Each line of file.txt has the first occurrence of âfooâ replaced with âbarâ, then the new line is wri

inspect

inspect() Instance Public methods Alias for: to_s

internal_encoding

ARGF.internal_encoding â encoding Instance Public methods Returns the internal encoding for strings read from ARGF as an Encoding object. If ARGF.set_encoding has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil is returned.

lineno

ARGF.lineno â integer Instance Public methods Returns the current line number of ARGF as a whole. This value can be set manually with ARGF.lineno=. For example: ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1

lineno=

ARGF.lineno = integer â integer Instance Public methods Sets the line number of ARGF as a whole to the given Integer. ARGF sets the line number automatically as you read data, so normally you will not need to set it explicitly. To access the current line number use ARGF.lineno. For example: ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1 ARGF.lineno = 0 #=> 0 ARGF.lineno #=> 0

lines

lines(*args) Instance Public methods This is a deprecated alias for each_line.

path

ARGF.path â 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"

pos

ARGF.pos â Integer Instance Public methods Returns the current offset (in bytes) of the current file in ARGF. ARGF.pos #=> 0 ARGF.gets #=> "This is line one\n" ARGF.pos #=> 17

pos=

ARGF.pos = position â Integer Instance Public methods Seeks to the position given by position (in bytes) in ARGF. For example: ARGF.pos = 17 ARGF.gets #=> "This is line two\n"

print

ios.print() â nilios.print(obj, ...) â nil Instance Public methods Writes the given object(s) to ios. The stream must be opened for writing. If the output field separator ($,) is not nil, it will be inserted between each object. If the output record separator ($\) is not nil, it will be appended to the output. If no arguments are given, prints $_. Objects that aren't strings will be converted by calling their to_s method. With no argument, prints the contents of th