Permalink
Browse files

Fix an off by one error in my Range#relative_to workaround

  • Loading branch information...
1 parent 4defae5 commit 7a4effc5adee5039d4fff8f923e7068a33d07ad0 @ferrous26 ferrous26 committed Mar 31, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 range.c
View
@@ -969,7 +969,7 @@ range_relative_to(VALUE range, SEL sel, VALUE max)
{
long beg, len, m = NUM2LONG(max);
rb_range_beg_len(range, &beg, &len, m, 0);
- if (beg + len - 1 > m)
+ if (beg + len > m)
len -= 1;
return rb_range_new(LONG2NUM(beg), LONG2NUM(beg + len - 1), 0);
}

0 comments on commit 7a4effc

Please sign in to comment.