Permalink
Browse files

String#upto returns an Enumerator object if a block is not passed

  • Loading branch information...
1 parent 33add5d commit d1f85a9e70996e410fea20ab9054c8a8bcaa474a @Watson1978 Watson1978 committed Apr 6, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 string.c
View
@@ -5150,6 +5150,7 @@ rstr_upto(VALUE str, SEL sel, int argc, VALUE *argv)
VALUE beg = str;
VALUE end, exclusive;
rb_scan_args(argc, argv, "11", &end, &exclusive);
+ RETURN_ENUMERATOR(beg, argc, argv);
bool excl = RTEST(exclusive);
StringValue(end);

0 comments on commit d1f85a9

Please sign in to comment.