Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 7a4effc5adee5039d4fff8f923e7068a33d07ad0 1 parent 4defae5
@ferrous26 ferrous26 authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  range.c
View
2  range.c
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.