From: Mauricio Fernandez Date: 2006-02-02T08:17:41+09:00 Subject: Re: [RCR] Numeric#of On Thu, Feb 02, 2006 at 01:03:30AM +0900, Jacob Fugal wrote: > On 1/31/06, Yukihiro Matsumoto wrote: > > If returns a enumerator object just like other enumerable methods do > > if no block is given to them. > > Sweet! I've wanted this sort of enumerator generation for a while. Is > this new across the board in 1.9, or have I just been stupid in > assuming it didn't work when it has this whole time? It's been working for Enumerable (and similar) methods for a while (in 1.9): Fri Jul 15 00:11:36 2005 Nobuyoshi Nakada * enum.c (enumeratorize): create new enumerator for current method if no block is given. * enumerator.c: moved from ext/enumerator. batsman@tux-chan:~/src/ruby/ruby.head$ grep -B 8 RETURN_ENUMERA -h *.c | egrep '^\w+\(' rb_ary_index(int argc, VALUE *argv, VALUE ary) rb_ary_rindex(int argc, VALUE *argv, VALUE ary) rb_ary_each(VALUE ary) rb_ary_each_index(VALUE ary) rb_ary_reverse_each(VALUE ary) rb_ary_collect(VALUE ary) rb_ary_collect_bang(VALUE ary) rb_ary_select(VALUE ary) rb_ary_reject_bang(VALUE ary) rb_ary_reject(VALUE ary) dir_each(VALUE dir) enum_find(int argc, VALUE *argv, VALUE obj) enum_find_all(VALUE obj) enum_reject(VALUE obj) enum_collect(VALUE obj) enum_partition(VALUE obj) enum_sort_by(VALUE obj) enum_min_by(VALUE obj) enum_max_by(VALUE obj) enum_each_with_index(VALUE obj) rb_hash_select(VALUE hash) rb_hash_each_value(VALUE hash) rb_hash_each_key(VALUE hash) rb_hash_each_pair(VALUE hash) rb_hash_each(VALUE hash) env_each_key(VALUE ehash) env_each_value(VALUE ehash) env_each(VALUE ehash) env_each_pair(VALUE ehash) env_select(VALUE ehash) rb_io_each_line(int argc, VALUE *argv, VALUE io) rb_io_each_byte(VALUE io) rb_io_s_foreach(int argc, VALUE *argv, VALUE self) argf_each_line(int argc, VALUE *argv, VALUE self) argf_each_byte(VALUE self) range_step(int argc, VALUE *argv, VALUE range) range_each(VALUE range) rb_str_each_byte(VALUE str) rb_struct_each(VALUE s) rb_struct_each_pair(VALUE s) -- Mauricio Fernandez