Project

General

Profile

Actions

Bug #21174

closed

Range#max called with an argument on a beginless Integer Range raises RangeError

Added by andrykonchin (Andrew Konchin) 6 days ago. Updated 5 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:121252]

Description

It seems surprising but instead of returning last n Integers Range#max(n) raises RangeError:

(nil..10).max(2)
# => (irb):3:in 'Range#max': cannot get the maximum of beginless range with custom comparison method (RangeError)

I would expect [9, 10] to be returned.

Actions

Also available in: Atom PDF

Like0
Like1Like0