crystal
crystal copied to clipboard
Add a method to `Range` to detect overlap/intersection with another `Range`
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))