summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-04 14:56:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-04 14:58:15 +0900
commita73f13c9070a5189947641638398cbffb8d012d8 (patch)
treed0cbd780cf9dd48ce5998f538e42f5a646c17a1e /hash.c
parentf810c007cf449d91303a0e8aff3f948f1d3f8068 (diff)
downloadruby-a73f13c9070a5189947641638398cbffb8d012d8.tar.gz
[DOC] `Hash.[]` returns a hash with no default value/proc [ci skip]
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index 33b553d466..ec41bf13c7 100644
--- a/hash.c
+++ b/hash.c
@@ -1814,21 +1814,27 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
*
* 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