summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-25 13:52:07 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-25 13:52:07 +0000
commitb1a8c64483b5ba5e4a391aa68234e7bde6355034 (patch)
treefc7dc594e220ba737a0138666eed8841b55ab243 /array.c
parentd1ea2f9d8f10ca728d178de92a26668c64f4aff8 (diff)
downloadruby-b1a8c64483b5ba5e4a391aa68234e7bde6355034.tar.gz
Add a new #filter alias for #select
* In Enumerable, Enumerator::Lazy, Array, Hash and Set [Feature #13784] [ruby-core:82285] * Share specs for the various #select#select! methods and reuse them for #filter/#filter!. * Add corresponding filter tests for select tests. * Update NEWS. [Fix GH-1824] From: Alexander Patrick <adp90@case.edu> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/array.c b/array.c
index f97447f7ea..1d536284d5 100644
--- a/array.c
+++ b/array.c
@@ -6298,6 +6298,8 @@ Init_Array(void)
rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
rb_define_method(rb_cArray, "select", rb_ary_select, 0);
rb_define_method(rb_cArray, "select!", rb_ary_select_bang, 0);
+ rb_define_method(rb_cArray, "filter", rb_ary_select, 0);
+ rb_define_method(rb_cArray, "filter!", rb_ary_select_bang, 0);
rb_define_method(rb_cArray, "keep_if", rb_ary_keep_if, 0);
rb_define_method(rb_cArray, "values_at", rb_ary_values_at, -1);
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);