Fix Range#min fast path with exclusive range

This commit is contained in:
Ryan Lopopolo
2019-07-09 01:48:15 -07:00
parent 0ad5ba7a0f
commit 56929362f5
2 changed files with 1 additions and 1 deletions
-1
View File
@@ -58,7 +58,6 @@ class Range
return nil if val == last && exclude_end?
min = val
min -= 1 if exclude_end?
return min
end
+1
View File
@@ -87,6 +87,7 @@ end
assert('Range#min') do
# returns the minimum value in the range when called with no arguments
assert_equal 1, (1..10).min
assert_equal 1, (1...10).min
# returns the minimum value in the Float range when called with no arguments
assert_equal 303.20, (303.20..908.1111).min