crystal icon indicating copy to clipboard operation
crystal copied to clipboard

Add a method to `Range` to detect overlap/intersection with another `Range`

Open jgaskins opened this issue 1 year ago • 0 comments

The Range type doesn't currently tell you if it overlaps with another instance, but it's a useful thing to check for. For example, a scheduling app may need to detect whether a given time period conflicts with any existing meetings/events:

existing_events.any?(&.overlaps?(range))

jgaskins avatar Apr 15 '24 04:04 jgaskins