diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-14 07:04:30 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-14 07:04:30 +0000 |
commit | 8ca8703de2a124e11bd87abe84c41553b0daed54 (patch) | |
tree | fb86fc2d237773ad2d874bb9426372fa701b26f9 /array.c | |
parent | 4f56ca8218e4cd02a8de43ca78d9a1c78d278067 (diff) |
* enum.c (enum_count, enum_find_index): New methods:
Enumerable#count and #find_index; backported from 1.9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -945,6 +945,8 @@ rb_ary_fetch(argc, argv, ary) * a.index("b") #=> 1 * a.index("z") #=> nil * a.index{|x|x=="b"} #=> 1 + * + * This is an alias of <code>#find_index</code>. */ static VALUE @@ -3157,6 +3159,7 @@ Init_Array() rb_define_method(rb_cArray, "length", rb_ary_length, 0); rb_define_alias(rb_cArray, "size", "length"); rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0); + rb_define_method(rb_cArray, "find_index", rb_ary_index, -1); rb_define_method(rb_cArray, "index", rb_ary_index, -1); rb_define_method(rb_cArray, "rindex", rb_ary_rindex, -1); rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1); |