diff options
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | enumerator.c | 20 |
3 files changed, 20 insertions, 12 deletions
@@ -1,3 +1,13 @@ +Tue May 13 15:10:50 2008 Akinori MUSHA <knu@iDaemons.org> + + * enumerator.c: Update rdoc. + (enumerator_initialize): Discourage the use. + (enum_each_slice, enum_each_cons, enumerator_each) + (enumerator_with_index): Add a note about a call without a block. + + * NEWS: Intentionally omit enum_slice and enum_cons, which are + removed in 1.9. + Tue May 13 07:56:36 2008 Yukihiro Matsumoto <matz@ruby-lang.org> * string.c (rb_str_cat): fixed buffer overrun reported by @@ -87,9 +87,7 @@ with all sufficient information, see the ChangeLog file. New class for various enumeration defined by the enumerator library. * Enumerable#each_slice - * Enumerable#enum_slice * Enumerable#each_cons - * Enumerable#enum_cons * Object#to_enum * Object#enum_for diff --git a/enumerator.c b/enumerator.c index 2cb3ca01e3..8ec8b2f60b 100644 --- a/enumerator.c +++ b/enumerator.c @@ -138,8 +138,10 @@ each_slice_i(val, memo) /* * call-seq: * e.each_slice(n) {...} + * e.each_slice(n) * - * Iterates the given block for each slice of <n> elements. + * Iterates the given block for each slice of <n> elements. If no + * block is given, returns an enumerator. * * e.g.: * (1..10).each_slice(3) {|a| p a} @@ -192,9 +194,10 @@ each_cons_i(val, memo) /* * call-seq: * each_cons(n) {...} + * each_cons(n) * * Iterates the given block for each array of consecutive <n> - * elements. + * elements. If no block is given, returns an enumerator.a * * e.g.: * (1..10).each_cons(3) {|a| p a} @@ -271,12 +274,8 @@ enumerator_init(enum_obj, obj, meth, argc, argv) * used as an Enumerable object using the given object's given * method with the given arguments. * - * e.g.: - * str = "xyz" - * - * enum = Enumerable::Enumerator.new(str, :each_byte) - * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"] - * + * Use of this method is not discouraged. Use Kernel#enum_for() + * instead. */ static VALUE enumerator_initialize(argc, argv, obj) @@ -330,7 +329,7 @@ rb_enumeratorize(obj, meth, argc, argv) * enum.each {...} * * Iterates the given block using the object and the method specified - * in the first place. + * in the first place. If no block is given, returns self. * */ static VALUE @@ -364,9 +363,10 @@ enumerator_with_index_i(val, memo) /* * call-seq: * e.with_index {|(*args), idx| ... } + * e.with_index * * Iterates the given block for each elements with an index, which - * start from 0. + * start from 0. If no block is given, returns an enumerator. * */ static VALUE |
