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")
endEach line of file.txt has the first occurrence of âfooâ replaced with âbarâ, then the new line is written out to file.txt.bak.
Please login to continue.