Skip to content

Commit 4ad6989

Browse files
committed
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]
1 parent 708d06f commit 4ad6989

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

io.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14094,9 +14094,9 @@ argf_to_s(VALUE argf)
1409414094
* call-seq:
1409514095
* ARGF.inplace_mode -> String
1409614096
*
14097-
* Returns the file extension appended to the names of modified files under
14098-
* in-place edit mode. This value can be set using +ARGF.inplace_mode=+ or
14099-
* passing the +-i+ switch to the Ruby binary.
14097+
* Returns the file extension appended to the names of backup copies of
14098+
* modified files under in-place edit mode. This value can be set using
14099+
* +ARGF.inplace_mode=+ or passing the +-i+ switch to the Ruby binary.
1410014100
*/
1410114101
static VALUE
1410214102
argf_inplace_mode_get(VALUE argf)
@@ -14117,8 +14117,8 @@ opt_i_get(ID id, VALUE *var)
1411714117
* ARGF.inplace_mode = ext -> ARGF
1411814118
*
1411914119
* Sets the filename extension for in-place editing mode to the given String.
14120-
* Each file being edited has this value appended to its filename. The
14121-
* modified file is saved under this new name.
14120+
* The backup copy of each file being edited has this value appended to its
14121+
* filename.
1412214122
*
1412314123
* For example:
1412414124
*
@@ -14129,8 +14129,9 @@ opt_i_get(ID id, VALUE *var)
1412914129
* print line.sub("foo","bar")
1413014130
* end
1413114131
*
14132-
* Each line of _file.txt_ has the first occurrence of "foo" replaced with
14133-
* "bar", then the new line is written out to _file.txt.bak_.
14132+
* First, _file.txt.bak_ is created as a backup copy of _file.txt_.
14133+
* Then, each line of _file.txt_ has the first occurrence of "foo" replaced with
14134+
* "bar".
1413414135
*/
1413514136
static VALUE
1413614137
argf_inplace_mode_set(VALUE argf, VALUE val)

0 commit comments

Comments
 (0)