ruby-changes:48238
From: kazu <ko1@a...>
Date: Sun, 22 Oct 2017 16:02:01 +0900 (JST)
Subject: [ruby-changes:48238] kazu:r60353 (trunk): Update doc of Hash#slice [ci skip]
kazu 2017-10-22 16:01:57 +0900 (Sun, 22 Oct 2017) New Revision: 60353 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60353 Log: Update doc of Hash#slice [ci skip] - Add arguments to call-seq - Add sample of multiple keys - Add sample: hash does not contain key Modified files: trunk/hash.c Index: hash.c =================================================================== --- hash.c (revision 60352) +++ hash.c (revision 60353) @@ -1326,13 +1326,14 @@ rb_hash_reject(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L1326 /* * 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/