summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-10 04:49:44 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-10 04:49:44 +0000
commit33791cd092488b6a9d7f9b78a9be312b1fccd713 (patch)
tree1ee784756c3550c20b99cf618326d591689cc849 /enumerator.c
parent3ef25ed7553b2151ce468054cb6d1e38f1fc2e52 (diff)
enumerator.c: fix for non-integral argument for ArithmeticSequence#last
This fixes a bug of Enumerator::ArithmeticSequence#last in the case that a non-integral argument is passed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/enumerator.c b/enumerator.c
index 9e48fdd..35775b8 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -2495,6 +2495,9 @@ arith_seq_last(int argc, VALUE *argv, VALUE self)
}
rb_scan_args(argc, argv, "1", &nv);
+ if (!RB_INTEGER_TYPE_P(nv)) {
+ nv = rb_to_int(nv);
+ }
if (RTEST(rb_int_gt(nv, len))) {
nv = len;
}