summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-28 07:31:32 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-28 07:31:32 (GMT)
commitd07861fb2fdaec6a630f7198801720cd7581bbab (patch)
treed86939efa049d71963f132597e871ac06f056542 /range.c
parentb6e2851431a12edff6259e876818fee8f4506acb (diff)
range.c: each on endless range
* range.c (range_each): endless range begins with string-like object should iterate from the converted result string, as well as `#each` on a string-end range or `#step` method on an endless range, i.e., `begin.succ` should not be called. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/range.c b/range.c
index 67ead72..88a35ab 100644
--- a/range.c
+++ b/range.c
@@ -834,10 +834,9 @@ range_each(VALUE range)
args[1] = EXCL(range) ? Qtrue : Qfalse;
rb_block_call(tmp, rb_intern("upto"), 2, args, each_i, 0);
}
- else if (RB_TYPE_P(beg, T_STRING)) {
- rb_str_upto_endless_each(beg, (VALUE (*)(VALUE, VALUE))each_i, 0);
+ else {
+ rb_str_upto_endless_each(tmp, (VALUE (*)(VALUE, VALUE))each_i, 0);
}
- else goto inf_loop;
}
else {
if (!discrete_object_p(beg)) {