[前][次][番号順一覧][スレッド一覧]

ruby-changes:71883

From: David <ko1@a...>
Date: Fri, 20 May 2022 17:23:58 +0900 (JST)
Subject: [ruby-changes:71883] ec7b42eb77 (master): [DOC] Add a note to clarify binary flags to `IO.new`

https://git.ruby-lang.org/ruby.git/commit/?id=ec7b42eb77

From ec7b42eb774222b31f6621413d3b7714f049cfb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 20 May 2022 10:23:45 +0200
Subject: [DOC] Add a note to clarify binary flags to `IO.new`

Try to make it more clear that the `File::BINARY` integer flag, and the
`b` string suffix are not equivalent.
---
 io.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/io.c b/io.c
index 0a78e0b200..defdecd7d9 100644
--- a/io.c
+++ b/io.c
@@ -14212,7 +14212,7 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y) https://github.com/ruby/ruby/blob/trunk/io.c#L14212
  *  ==== Read/Write Mode Specified as an \Integer
  *
  *  When +mode+ is an integer it must be one or more (combined by bitwise OR (<tt>|</tt>)
- *  of the modes defined in File::Constants:
+ *  of the following modes:
  *
  *  - +File::RDONLY+: Open for reading only.
  *  - +File::WRONLY+: Open for writing only.
@@ -14277,6 +14277,12 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y) https://github.com/ruby/ruby/blob/trunk/io.c#L14277
  *
  *    File.open('t.tmp', 'wx')
  *
+ *  Note that when using integer flags to set the read/write mode, it's not
+ *  possible to also set the binary data mode by adding the File::BINARY flag
+ *  to the bitwise OR combination of integer flags. This is because, as
+ *  documented in File::Constants, the File::BINARY flag only disables line code
+ *  conversion, but does not change the external encoding at all.
+ *
  *  == Encodings
  *
  *  Any of the string modes above may specify encodings --
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]