Skip to content

Add Range#overlap? - #468

Merged
tannevaled merged 1 commit into
mainfrom
feat/cluster38
Aug 27, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/cluster38

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Range#overlap?(other) reports whether two ranges share at least one element,
mirroring MRI's algorithm: the ranges are disjoint when one's end falls below the
other's begin (touching ends count only when both are inclusive), and an empty
range — backward, or begin equal to an exclusive end — overlaps nothing. A nil
bound is treated as an infinity; incomparable bounds report no overlap; and a
non-Range argument raises TypeError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 15790 → 15800 (core/range/overlap 0 → 9, zero regressions
in a deterministic per-file sweep).

🤖 Generated with Claude Code

Range#overlap?(other) reports whether two ranges share at least one element,
mirroring MRI's algorithm: the ranges are disjoint when one's end falls below the
other's begin (touching ends count only when both are inclusive), and an empty
range — backward, or begin equal to an exclusive end — overlaps nothing. A nil
bound is an infinity; a non-Range argument raises TypeError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 15790 -> 15800 (core/range/overlap 0 -> 9).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 3ab3baf into main Aug 27, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/cluster38 branch August 27, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant