summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-13 06:13:05 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-13 06:13:05 +0000
commit8cf1995901b8397f52b905d7f24835e9fec424d8 (patch)
treeae92a22431311efccd87ad2062706cbb0ca7816e
parent28693296b766bfc32b218548f769f87474373626 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--NEWS2
-rw-r--r--enumerator.c20
3 files changed, 20 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ab2e2af3f9..ad8ab27f87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/NEWS b/NEWS
index a75cde9aa3..ec2e32e1f4 100644
--- a/NEWS
+++ b/NEWS
@@ -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