General

Profile

shouichi (Shouichi Kamiya)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 2 3 5

Activity

09/21/2023

06:10 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Asked them in their discord channel. https://discord.com/channels/849034466856665118/974005005768069211/1154298190120624138 shouichi (Shouichi Kamiya)

09/19/2023

09:34 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Because `(...-Float::INFINITY)` is semantically empty, shouldn't `none?` return `true`? shouichi (Shouichi Kamiya)
12:31 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Shouldn't `none?` handle empty ranges? Currently, it raises an error.
```
> (...-Float::INFINITY).none?
(irb):1:in `each': can't iterate from NilClass (TypeError)
```
If `none?` handles empty ranges, then `overlap?` can return f...
shouichi (Shouichi Kamiya)

09/16/2023

05:57 AM Ruby Feature #19839 (Closed): Need a method to check if two ranges overlap
Applied in changeset commit:git|e9b503f1bb9692eda1d1f55f62c19d861b88a0d5.
----------
[Feature #19839] Add Range#overlap?
Add a method that returns true if two range overlap, otherwise false.
```
(0..10).overlap?(5..15) #=> true
(0..10...
shouichi (Shouichi Kamiya)
05:57 AM Ruby Revision e9b503f1 (git): [Feature #19839] Add Range#overlap?
Add a method that returns true if two range overlap, otherwise false.
```
(0..10).overlap?(5..15) #=> true
(0..10).overlap?(20..30) #=> false
```
shouichi (Shouichi Kamiya)

09/15/2023

08:46 AM Ruby Feature #19839: Need a method to check if two ranges overlap
I opened a PR about a month ago but should I close it...? https://github.com/ruby/ruby/pull/8242 shouichi (Shouichi Kamiya)

09/13/2023

05:19 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Honestly, I can't give a formal reason. But I do believe it's a very basic operation. For example, postgres and boost provide such functionality.
- https://www.postgresql.org/docs/15/functions-range.html
- https://www.boost.org/doc/l...
shouichi (Shouichi Kamiya)

09/12/2023

08:54 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Though ActiveSupport's `overlaps?` method is enough for our use-case. I think the feature is so fundamental that it should be supported by the standard library.
Slightly off-topic: It might be better to add a method that returns the o...
shouichi (Shouichi Kamiya)

08/18/2023

06:56 AM Ruby Feature #19839: Need a method to check if two ranges overlap
Thank you for your feedback.
> I've made several helpers for this exact same problem, as well as a `Range#merge` in the past.
Yes, `Range` class can have methods such as `Range#merge` but I wanted to start small and see what happen...
shouichi (Shouichi Kamiya)
01:30 AM Ruby Feature #19839 (Closed): Need a method to check if two ranges overlap
It would be convenient to have a method that checks if two ranges overlap. For example,
```
(0..10).overlap?(5..15) #=> true
(0..10).overlap?(20..30) #=> false
```
shouichi (Shouichi Kamiya)

Also available in: Atom