Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Kernel#to_enum: implemented

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2317 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
commit c6a03419f3672d3ea8f6a580132703a85e489dce 1 parent e5c5772
Laurent Sansonetti authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 enumerator.c
View
14 enumerator.c
@@ -82,8 +82,18 @@ obj_to_enum(VALUE obj, SEL sel, int argc, VALUE *argv)
--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
Please sign in to comment.
Something went wrong with that request. Please try again.