summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-04 11:43:09 +0000
committerstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-04 11:43:09 +0000
commit83e459b2f3afc48ff4b6c61b713e2854ccd30a13 (patch)
tree4fbc35cd9e15ed2109ba49224a8c1d12570da15d /hash.c
parentb3adc0c5647f0c96cdc7cecad07fe82e5e63827c (diff)
hash.c: [DOC] add docs for Hash#{filter,filter!}
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 65f8539..26971c8 100644
--- a/hash.c
+++ b/hash.c
@@ -2322,6 +2322,8 @@ select_i(VALUE key, VALUE value, VALUE result)
* 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 result)
* 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 hash)
* 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