method

inplace_mode=

Importance_1
v1_9_2_180 - Show latest stable - 0 notes - Class: ARGF
inplace_mode=(p1) public

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.

Show source
Register or log in to add new notes.