[#6143] — Christophe Poucet <christophe.poucet@...>

Hello,

17 messages 2005/10/04
[#6147] Re: patch.tgz — nobu.nokada@... 2005/10/04

Hi,

[#6199] Kernel rdoc HTML file not being created when rdoc is run on 1.8.3 — James Britt <ruby@...>

When 1.8.3 came out, I grabbed the source and ran rdoc on it. After

9 messages 2005/10/08

[#6251] RubyGems, upstream releases and idempotence of packaging — Mauricio Fern疣dez <mfp@...>

[sorry for the very late reply; I left this message in +postponed and forgot

14 messages 2005/10/12

[#6282] Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...>

Testing the My Object Dump and I am trying to cause creation

13 messages 2005/10/14
[#6283] Re: Wilderness: Need Code to invoke ELTS_SHARED response — Mauricio Fern疣dez <mfp@...> 2005/10/14

On Fri, Oct 14, 2005 at 05:04:59PM +0900, Charles E. Thornton wrote:

[#6288] Re: Wilderness: Need Code to invoke ELTS_SHARED response — "Charles E. Thornton" <ruby-core@...> 2005/10/14

Mauricio Fern疣dez wrote:

[#6365] Time for built-in Rational and Complex classes? — Gavin Sinclair <gsinclair@...>

There has been some support for, but no comment on, RCR #260 ("Make

12 messages 2005/10/24
[#6366] Re: Time for built-in Rational and Complex classes? — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/24

On Mon, 24 Oct 2005, Gavin Sinclair wrote:

[#6405] Re: [PATCH] Pathname.exists?() — "Berger, Daniel" <Daniel.Berger@...>

12 messages 2005/10/25
[#6406] Re: [PATCH] Pathname.exists?() — TRANS <transfire@...> 2005/10/25

On 10/25/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

[#6408] Re: [PATCH] Pathname.exists?() — Gavin Sinclair <gsinclair@...> 2005/10/25

On 10/26/05, TRANS <transfire@gmail.com> wrote:

[#6442] Wilderness: I Have formatted README.EXT into an HTML Document — "Charles E. Thornton" <ruby-core@...>

I have taken README.EXT (English Version Only) and have reformatted

14 messages 2005/10/27

[#6469] csv.rb a start on refactoring. — Hugh Sasse <hgs@...>

For a database application I found using CSV to be rather slow.

50 messages 2005/10/28
[#6470] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

[#6471] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/28

On Oct 28, 2005, at 8:53 AM, Ara.T.Howard wrote:

[#6474] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/28

On Fri, 28 Oct 2005, James Edward Gray II wrote:

[#6484] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 9:58 AM, Ara.T.Howard wrote:

[#6485] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6486] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:25 PM, Ara.T.Howard wrote:

[#6487] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sat, 29 Oct 2005, James Edward Gray II wrote:

[#6491] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 8:43 PM, Ara.T.Howard wrote:

[#6493] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/29

On Oct 28, 2005, at 10:06 PM, James Edward Gray II wrote:

[#6496] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/29

On Sun, 30 Oct 2005, James Edward Gray II wrote:

[#6502] Re: csv.rb a start on refactoring. — James Edward Gray II <james@...> 2005/10/30

On Oct 29, 2005, at 12:11 PM, Ara.T.Howard wrote:

[#6505] Re: csv.rb a start on refactoring. — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/30

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6511] Planning FasterCSV (was Re: csv.rb a start on refactoring.) — James Edward Gray II <james@...> 2005/10/30

I've decided to create a FasterCSV library, based on the code we

[#6516] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "Ara.T.Howard" <Ara.T.Howard@...> 2005/10/31

On Mon, 31 Oct 2005, James Edward Gray II wrote:

[#6518] Re: Planning FasterCSV (was Re: csv.rb a start on refactoring.) — "NAKAMURA, Hiroshi" <nakahiro@...> 2005/10/31

-----BEGIN PGP SIGNED MESSAGE-----

[PATCH] Enumerator Docs

From: James Edward Gray II <james@...>
Date: 2005-10-22 18:28:03 UTC
List: ruby-core #6348
The attached patch adds the Enumerator documentation from 1.9 to the  
ruby_1_8 branch.

Please tell me if there is any reason this cannot be applied.   
Otherwise, would some kind soul please commit this?

Thank you.

James Edward Gray II

Attachments (1)

enumerator_docs.diff (3.57 KB, text/x-diff)
Index: ext/enumerator/enumerator.c
===================================================================
RCS file: /src/ruby/ext/enumerator/Attic/enumerator.c,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 enumerator.c
--- ext/enumerator/enumerator.c	4 Nov 2004 01:20:50 -0000	1.3.2.2
+++ ext/enumerator/enumerator.c	14 Oct 2005 13:47:50 -0000
@@ -15,10 +15,34 @@
 #include "ruby.h"
 #include "node.h"
 
+/*
+ * Document-class: Enumerable::Enumerator
+ *
+ * A class which provides a method `each' to be used as an Enumerable
+ * object.
+ */
 static VALUE rb_cEnumerator;
 static ID sym_each, sym_each_with_index, sym_each_slice, sym_each_cons;
 static ID id_new, id_enum_obj, id_enum_method, id_enum_args;
 
+/*
+ *  call-seq:
+ *    obj.to_enum(method = :each, *args)
+ *    obj.enum_for(method = :each, *args)
+ *
+ *  Returns Enumerable::Enumerator.new(self, method, *args).
+ *
+ *  e.g.:
+ *     str = "xyz"
+ *
+ *     enum = str.enum_for(:each_byte)
+ *     a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
+ *
+ *     # protects an array from being modified
+ *     a = [1, 2, 3]
+ *     some_method(a.to_enum)
+ *
+ */
 static VALUE
 obj_to_enum(obj, enum_args)
     VALUE obj, enum_args;
@@ -28,6 +52,13 @@
     return rb_apply(rb_cEnumerator, id_new, enum_args);
 }
 
+/*
+ *  call-seq:
+ *    enum_with_index
+ *
+ *  Returns Enumerable::Enumerator.new(self, :each_with_index).
+ *
+ */
 static VALUE
 enumerator_enum_with_index(obj)
     VALUE obj;
@@ -53,6 +84,21 @@
     return Qnil;
 }
 
+/*
+ *  call-seq:
+ *    e.each_slice(n) {...}
+ *
+ *  Iterates the given block for each slice of <n> elements.
+ *
+ *  e.g.:
+ *      (1..10).each_slice(3) {|a| p a}
+ *      # outputs below
+ *      [1, 2, 3]
+ *      [4, 5, 6]
+ *      [7, 8, 9]
+ *      [10]
+ *
+ */
 static VALUE
 enum_each_slice(obj, n)
     VALUE obj, n;
@@ -73,6 +119,13 @@
     return Qnil;
 }
 
+/*
+ *  call-seq:
+ *    e.enum_slice(n)
+ *
+ *  Returns Enumerable::Enumerator.new(self, :each_slice, n).
+ *
+ */
 static VALUE
 enumerator_enum_slice(obj, n)
     VALUE obj, n;
@@ -98,6 +151,26 @@
     return Qnil;
 }
 
+/*
+ *  call-seq:
+ *    each_cons(n) {...}
+ *
+ *  Iterates the given block for each array of consecutive <n>
+ *  elements.
+ *
+ *  e.g.:
+ *      (1..10).each_cons(3) {|a| p a}
+ *      # outputs below
+ *      [1, 2, 3]
+ *      [2, 3, 4]
+ *      [3, 4, 5]
+ *      [4, 5, 6]
+ *      [5, 6, 7]
+ *      [6, 7, 8]
+ *      [7, 8, 9]
+ *      [8, 9, 10]
+ *
+ */
 static VALUE
 enum_each_cons(obj, n)
     VALUE obj, n;
@@ -113,6 +186,13 @@
     return Qnil;
 }
 
+/*
+ *  call-seq:
+ *    e.enum_cons(n)
+ *
+ *  Returns Enumerable::Enumerator.new(self, :each_cons, n).
+ *
+ */
 static VALUE
 enumerator_enum_cons(obj, n)
     VALUE obj, n;
@@ -120,6 +200,21 @@
     return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_cons, n);
 }
 
+/*
+ *  call-seq:
+ *    Enumerable::Enumerator.new(obj, method = :each, *args)
+ *
+ *  Creates a new Enumerable::Enumerator object, which is to be
+ *  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"]
+ *
+ */
 static VALUE
 enumerator_initialize(argc, argv, obj)
     int argc;
@@ -147,6 +242,14 @@
     return rb_apply(memo->u1.value, memo->u2.id, memo->u3.value);
 }
 
+/*
+ *  call-seq:
+ *    enum.each {...}
+ *
+ *  Iterates the given block using the object and the method specified
+ *  in the first place.
+ *
+ */
 static VALUE
 enumerator_each(obj)
     VALUE obj;

In This Thread

Prev Next