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

ruby-changes:66680

From: Nobuyoshi <ko1@a...>
Date: Sun, 4 Jul 2021 15:28:14 +0900 (JST)
Subject: [ruby-changes:66680] a73f13c907 (master): [DOC] `Hash.[]` returns a hash with no default value/proc [ci skip]

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

From a73f13c9070a5189947641638398cbffb8d012d8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 4 Jul 2021 14:56:23 +0900
Subject: [DOC] `Hash.[]` returns a hash with no default value/proc [ci skip]

---
 hash.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/hash.c b/hash.c
index 33b553d..ec41bf1 100644
--- a/hash.c
+++ b/hash.c
@@ -1814,21 +1814,27 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L1814
  *
  *  With no argument, returns a new empty \Hash.
  *
- *  When the single given argument is a \Hash,
- *  returns a new \Hash populated with the entries from the given \Hash.
+ *  When the single given argument is a \Hash, returns a new \Hash
+ *  populated with the entries from the given \Hash, excluding the
+ *  default value or proc.
+ *
  *    h = {foo: 0, bar: 1, baz: 2}
  *    Hash[h] # => {:foo=>0, :bar=>1, :baz=>2}
  *
  *  When the single given argument is an \Array of 2-element Arrays,
- *  returns a new \Hash object wherein each 2-element array forms a key-value entry:
+ *  returns a new \Hash object wherein each 2-element array forms a
+ *  key-value entry:
+ *
  *    Hash[ [ [:foo, 0], [:bar, 1] ] ] # => {:foo=>0, :bar=>1}
  *
  *  When the argument count is an even number;
  *  returns a new \Hash object wherein each successive pair of arguments
  *  has become a key-value entry:
+ *
  *    Hash[:foo, 0, :bar, 1] # => {:foo=>0, :bar=>1}
  *
- *  Raises an exception if the argument list does not conform to any of the above.
+ *  Raises an exception if the argument list does not conform to any
+ *  of the above.
  */
 
 static VALUE
-- 
cgit v1.1


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

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