Issue #9604 has been updated by jeremyevans0 (Jeremy Evans).

Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN)
Status changed from Open to Closed

Ruby 2.6 added support to `Range#cover?` to accept Range arguments, which you can use instead of `include?`:

```
$ ruby25 -e 'p (1..10).cover?(2..7)' 
false
$ ruby26 -e 'p (1..10).cover?(2..7)' 
true
```

----------------------------------------
Bug #9604: Comparing ranges or range includes range
https://bugs.ruby-lang.org/issues/9604#change-79320

* Author: watman (Nick Kotykhov)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422)
* Backport: 
----------------------------------------
Hello guys,

First I got to say it's not like real bug - but will be good to have. Then in some case I I need compare to ranges on including each other: so I did like 
    (1..10).include? (2..7)  
what kinda logical, but it always *false*. So I have to use: 
    (1..10).grep(2..7).empty?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>