ruby-changes:72714
From: Jeremy <ko1@a...>
Date: Thu, 28 Jul 2022 07:31:14 +0900 (JST)
Subject: [ruby-changes:72714] 4ad69899b7 (master): Fix documentation for ARGF.inplace_mode{, =}
https://git.ruby-lang.org/ruby.git/commit/?id=4ad69899b7 From 4ad69899b7db1e384665dec090d5cdc0c3b3c9b2 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Wed, 27 Jul 2022 15:29:00 -0700 Subject: 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] --- io.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/io.c b/io.c index de09a97798..d90ff62660 100644 --- a/io.c +++ b/io.c @@ -14094,9 +14094,9 @@ argf_to_s(VALUE argf) https://github.com/ruby/ruby/blob/trunk/io.c#L14094 * call-seq: * ARGF.inplace_mode -> String * - * Returns the file extension appended to the names of modified files under - * in-place edit mode. This value can be set using +ARGF.inplace_mode=+ or - * passing the +-i+ switch to the Ruby binary. + * Returns the file extension appended to the names of backup copies of + * modified files under in-place edit mode. This value can be set using + * +ARGF.inplace_mode=+ or passing the +-i+ switch to the Ruby binary. */ static VALUE argf_inplace_mode_get(VALUE argf) @@ -14117,8 +14117,8 @@ opt_i_get(ID id, VALUE *var) https://github.com/ruby/ruby/blob/trunk/io.c#L14117 * ARGF.inplace_mode = ext -> ARGF * * 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. + * The backup copy of each file being edited has this value appended to its + * filename. * * For example: * @@ -14129,8 +14129,9 @@ opt_i_get(ID id, VALUE *var) https://github.com/ruby/ruby/blob/trunk/io.c#L14129 * 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_. + * First, _file.txt.bak_ is created as a backup copy of _file.txt_. + * Then, each line of _file.txt_ has the first occurrence of "foo" replaced with + * "bar". */ static VALUE argf_inplace_mode_set(VALUE argf, VALUE val) -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/