From a59c599209a11d4ab0dc0d7626ab3d5ca43a78c2 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 11 Dec 2001 03:48:08 +0000 Subject: * string.c (rb_str_match_m): should convert an argument into regexp if it's a string. * array.c (rb_ary_select): Array#select(n,m,...) now works like Array#indexes(n,m,..). [new, experimental] * hash.c (rb_hash_select): ditto. * hash.c (env_select): ditto. * re.c (match_select): ditto. * struct.c (rb_struct_select): ditto. * gc.c (STR_ASSOC): use FL_USER3 instead of FL_USER2. * parse.y (str_extend): make up pushback call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'array.c') diff --git a/array.c b/array.c index 0401dd3598..c9b66eb2ed 100644 --- a/array.c +++ b/array.c @@ -590,6 +590,8 @@ rb_ary_indexes(argc, argv, ary) VALUE new_ary; long i; + rb_warn("Array#%s is deprecated; use Array#select", + rb_id2name(rb_frame_last_func())); new_ary = rb_ary_new2(argc); for (i=0; i 0) { + rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); + } + for (i = 0; i < RARRAY(ary)->len; i++) { + if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) { + rb_ary_push(result, RARRAY(ary)->ptr[i]); + } + } + } + else { + for (i=0; i