diff options
author | Jeremy Evans <[email protected]> | 2019-07-24 10:30:56 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2019-07-24 10:35:28 -0700 |
commit | 3556cba5038530e728eb6309dcf5d4d1a96a02ac (patch) | |
tree | 727f5d879713783e6f60228a867f3f5ff0a17aa4 /range.c | |
parent | 1cce4303247110d94eab8326f187a2a80130b324 (diff) |
Document that Range#cover? returns false if <=> returns nil
Fixes [Bug #12090]
Diffstat (limited to 'range.c')
-rw-r--r-- | range.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1455,11 +1455,14 @@ static int r_cover_range_p(VALUE range, VALUE beg, VALUE end, VALUE val); * the end of the sequence must be calculated, which may exhibit poor * performance if <code>c</code> is non-numeric. * Returns <code>false</code> if the begin value of the - * range is larger than the end value. + * range is larger than the end value. Also returns +false+ if one of the + * internal calls to <code><=></code> returns +nil+ (indicating the objects + * are not comparable). * * ("a".."z").cover?("c") #=> true * ("a".."z").cover?("5") #=> false * ("a".."z").cover?("cc") #=> true + * ("a".."z").cover?(1) #=> false * (1..5).cover?(2..3) #=> true * (1..5).cover?(0..6) #=> false * (1..5).cover?(1...6) #=> true |