summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 01:27:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 01:27:19 +0000
commit0be97c701510f67e0786347d29f2c0286dcc4310 (patch)
tree1c7ae75a42775944d4b64e37212650741e2dbebe /range.c
parent354028abe18bc5862a1b45e2f45060bf85c1ae35 (diff)
range.c: revert r42400
* range.c (range_last): revert r42400. [Bug #8739] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/range.c b/range.c
index 0076254..8fa7dcb 100644
--- a/range.c
+++ b/range.c
@@ -887,22 +887,7 @@ range_first(int argc, VALUE *argv, VALUE range)
static VALUE
range_last(int argc, VALUE *argv, VALUE range)
{
- if (argc == 0) {
- VALUE e = RANGE_END(range);
- if (!EXCL(range)) return e; /* inclusive, the end is the last */
- /* exclusive, the last is previous to the end */
- if (FIXNUM_P(e) || rb_obj_is_kind_of(e, rb_cNumeric)) {
- VALUE pred = rb_int_pred(e);
- if (!r_lt(RANGE_BEG(range), pred)) {
- /* TODO: what should be returned, or should raise an
- * exception? */
- pred = Qnil;
- }
- return pred;
- }
-
- /* fallback to Array */
- }
+ if (argc == 0) return RANGE_END(range);
return rb_ary_last(argc, argv, rb_Array(range));
}