ARGF.inplace_mode = ext â ARGF
Instance Public methods
1 2 3 4 5 6 7 8 9 10 11 12 | 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 written out to file.txt.bak.
Please login to continue.