mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
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]
This commit is contained in:
parent
ac946e076c
commit
bb0e42c5e7
Notes:
git
2025-12-18 19:57:38 +00:00
1
array.c
1
array.c
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user