aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 07:01:57 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 07:01:57 +0000
commit91caec5e5eeebd84826923ee87b426e20d7494b0 (patch)
tree993ce886943cb35530002573bc3e9fce7cc26d53 /hash.c
parent64e2af8ee1e14e6b9571172b276a55d7e53b3e63 (diff)
downloadruby-91caec5e5eeebd84826923ee87b426e20d7494b0.tar.gz
Update doc of Hash#slice [ci skip]
- Add arguments to call-seq - Add sample of multiple keys - Add sample: hash does not contain key git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 25ab9959a4..23b01e8953 100644
--- a/hash.c
+++ b/hash.c
@@ -1326,13 +1326,14 @@ rb_hash_reject(VALUE hash)
/*
* call-seq:
- * hsh.slice -> a_hash
+ * hsh.slice(*keys) -> a_hash
*
* Slices a hash to include only the given keys.
* Returns a hash containing the given keys.
*
* h = { "a" => 100, "b" => 200, "c" => 300 }
- * h.slice("a") #=> {"a" => 100}
+ * h.slice("a") #=> {"a"=>100}
+ * h.slice("c", "d") #=> {"c"=>300}
*/
static VALUE