Skip to content

Add MatchData#bytebegin, #byteend and #byteoffset - #474

Merged
tannevaled merged 1 commit into
mainfrom
feat/cluster44
Aug 28, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/cluster44

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The byte-index counterparts of #begin / #end / #offset (Ruby 3.2+): they
return the raw byte position of a group's start and end, skipping the
byte-to-character conversion the character-offset methods apply. A group that did
not participate yields nil (or [nil, nil]); an unknown index or name raises
IndexError, matching the existing methods.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 15850 → 15870 (core/matchdata bytebegin +13, byteend +10,
byteoffset +8 = +31, zero regressions in a deterministic per-file sweep).

🤖 Generated with Claude Code

These are the byte-index counterparts of #begin / #end / #offset (Ruby 3.2+):
they return the raw byte position of a group's start and end, skipping the
byte-to-character conversion that the character-offset methods apply. A group
that did not participate yields nil (or [nil, nil]); an unknown index or name
raises IndexError, matching the existing methods.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 15850 -> 15870 (core/matchdata bytebegin +13, byteend +10,
byteoffset +8).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit d6b7c53 into main Aug 28, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/cluster44 branch August 28, 2026 09:47
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