method
inplace_mode=
v2_5_5 -
Show latest stable
-
0 notes -
Class: ARGF
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
inplace_mode=(p1)
public
Sets the filename extension for in-place 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.each_line 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.