[macruby-changes] [2317] MacRuby/trunk/enumerator.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 13 17:02:35 PDT 2009
Revision: 2317
http://trac.macosforge.org/projects/ruby/changeset/2317
Author: lsansonetti at apple.com
Date: 2009-08-13 17:02:33 -0700 (Thu, 13 Aug 2009)
Log Message:
-----------
Kernel#to_enum: implemented
Modified Paths:
--------------
MacRuby/trunk/enumerator.c
Modified: MacRuby/trunk/enumerator.c
===================================================================
--- MacRuby/trunk/enumerator.c 2009-08-13 23:49:27 UTC (rev 2316)
+++ MacRuby/trunk/enumerator.c 2009-08-14 00:02:33 UTC (rev 2317)
@@ -82,8 +82,18 @@
--argc;
meth = *argv++;
}
- // TODO
- return rb_enumeratorize(obj, 0, argc, argv);
+
+ ID meth_id = SYM2ID(meth);
+ SEL enum_sel;
+ if (argc > 0) {
+ char buf[100];
+ snprintf(buf, sizeof buf, "%s:", rb_id2name(meth_id));
+ enum_sel = sel_registerName(buf);
+ }
+ else {
+ enum_sel = sel_registerName(rb_id2name(meth_id));
+ }
+ return rb_enumeratorize(obj, enum_sel, argc, argv);
}
static VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090813/7ca653c8/attachment-0001.html>
More information about the macruby-changes
mailing list