ruby-changes:62694
From: Jeremy <ko1@a...>
Date: Tue, 25 Aug 2020 08:11:03 +0900 (JST)
Subject: [ruby-changes:62694] 9e25eb308d (master): Update PTY.open documentation to document it yields a single argument [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=9e25eb308d From 9e25eb308d4fae9a10e120c2b4601916cc38336c Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Mon, 24 Aug 2020 16:04:55 -0700 Subject: Update PTY.open documentation to document it yields a single argument [ci skip] For a regular block, accepting two arguments is fine as the array will be autosplatted. However, a lambda that accepts two arguments will not work. We could change the implementation to yield two arguments instead of an array with a single argument, but that would be less backwards compatible. I'm only changing the call-seq to be precise, other examples pass a literal block that accepts two arguments, and I left those alone as that will be the most common usage. Fixes [Bug #17094] diff --git a/ext/pty/pty.c b/ext/pty/pty.c index a513930..e53871e 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -464,11 +464,11 @@ pty_close_pty(VALUE assoc) https://github.com/ruby/ruby/blob/trunk/ext/pty/pty.c#L464 /* * call-seq: * PTY.open => [master_io, slave_file] - * PTY.open {|master_io, slave_file| ... } => block value + * PTY.open {|(master_io, slave_file)| ... } => block value * * Allocates a pty (pseudo-terminal). * - * In the block form, yields two arguments <tt>master_io, slave_file</tt> + * In the block form, yields an array of two elements (<tt>master_io, slave_file</tt>) * and the value of the block is returned from +open+. * * The IO and File are both closed after the block completes if they haven't -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/