diff options
| author | Étienne Barrié <etienne.barrie@gmail.com> | 2025-12-15 14:36:53 +0100 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2025-12-15 10:52:43 -0500 |
| commit | bb0e42c5e706f238dce40abb9cf5322e4a8a73cb (patch) | |
| tree | 6090cc0ec58332e4fbd0aefc1561cb532c8fc90d /array.c | |
| parent | ac946e076c0136b070c84f66c8b018f8ab6b2223 (diff) | |
Define Array#detect as an alias for Array#find
Otherwise Array#detect is Enumerable#detect while Array#find uses a
different more performant implementation.
[Feature #21678]
Diffstat (limited to 'array.c')
| -rw-r--r-- | array.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -8910,6 +8910,7 @@ Init_Array(void) rb_define_method(rb_cArray, "size", rb_ary_length, 0); rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0); rb_define_method(rb_cArray, "find", rb_ary_find, -1); + rb_define_method(rb_cArray, "detect", rb_ary_find, -1); rb_define_method(rb_cArray, "rfind", rb_ary_rfind, -1); rb_define_method(rb_cArray, "find_index", rb_ary_index, -1); rb_define_method(rb_cArray, "index", rb_ary_index, -1); |
