ruby-changes:53314
From: stomar <ko1@a...>
Date: Sun, 4 Nov 2018 20:43:14 +0900 (JST)
Subject: [ruby-changes:53314] stomar:r65530 (trunk): hash.c: [DOC] add docs for Hash#{filter, filter!}
stomar 2018-11-04 20:43:09 +0900 (Sun, 04 Nov 2018) New Revision: 65530 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65530 Log: hash.c: [DOC] add docs for Hash#{filter,filter!} Modified files: trunk/hash.c Index: hash.c =================================================================== --- hash.c (revision 65529) +++ hash.c (revision 65530) @@ -2322,6 +2322,8 @@ select_i(VALUE key, VALUE value, VALUE r https://github.com/ruby/ruby/blob/trunk/hash.c#L2322 * call-seq: * hsh.select {|key, value| block} -> a_hash * hsh.select -> an_enumerator + * hsh.filter {|key, value| block} -> a_hash + * hsh.filter -> an_enumerator * * Returns a new hash consisting of entries for which the block returns true. * @@ -2330,6 +2332,8 @@ select_i(VALUE key, VALUE value, VALUE r https://github.com/ruby/ruby/blob/trunk/hash.c#L2332 * h = { "a" => 100, "b" => 200, "c" => 300 } * h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300} * h.select {|k,v| v < 200} #=> {"a" => 100} + * + * Hash#filter is an alias for Hash#select. */ VALUE @@ -2358,9 +2362,13 @@ keep_if_i(VALUE key, VALUE value, VALUE https://github.com/ruby/ruby/blob/trunk/hash.c#L2362 * call-seq: * hsh.select! {| key, value | block } -> hsh or nil * hsh.select! -> an_enumerator + * hsh.filter! {| key, value | block } -> hsh or nil + * hsh.filter! -> an_enumerator * * Equivalent to Hash#keep_if, but returns * +nil+ if no changes were made. + * + * Hash#filter! is an alias for Hash#select!. */ VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/