1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix documentation for ARGF.inplace_mode{,=}

The value affects the name of the backup file created, not the
name of the file modified (as the file is modified in place).

Fixes [Bug #18920]
This commit is contained in:
Jeremy Evans 2022-07-27 15:29:00 -07:00
parent 708d06f301
commit 4ad69899b7

15
io.c
View file

@ -14094,9 +14094,9 @@ argf_to_s(VALUE argf)
* call-seq: * call-seq:
* ARGF.inplace_mode -> String * ARGF.inplace_mode -> String
* *
* Returns the file extension appended to the names of modified files under * Returns the file extension appended to the names of backup copies of
* in-place edit mode. This value can be set using +ARGF.inplace_mode=+ or * modified files under in-place edit mode. This value can be set using
* passing the +-i+ switch to the Ruby binary. * +ARGF.inplace_mode=+ or passing the +-i+ switch to the Ruby binary.
*/ */
static VALUE static VALUE
argf_inplace_mode_get(VALUE argf) argf_inplace_mode_get(VALUE argf)
@ -14117,8 +14117,8 @@ opt_i_get(ID id, VALUE *var)
* ARGF.inplace_mode = ext -> ARGF * ARGF.inplace_mode = ext -> ARGF
* *
* Sets the filename extension for in-place editing mode to the given String. * 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 * The backup copy of each file being edited has this value appended to its
* modified file is saved under this new name. * filename.
* *
* For example: * For example:
* *
@ -14129,8 +14129,9 @@ opt_i_get(ID id, VALUE *var)
* print line.sub("foo","bar") * print line.sub("foo","bar")
* end * end
* *
* Each line of _file.txt_ has the first occurrence of "foo" replaced with * First, _file.txt.bak_ is created as a backup copy of _file.txt_.
* "bar", then the new line is written out to _file.txt.bak_. * Then, each line of _file.txt_ has the first occurrence of "foo" replaced with
* "bar".
*/ */
static VALUE static VALUE
argf_inplace_mode_set(VALUE argf, VALUE val) argf_inplace_mode_set(VALUE argf, VALUE val)