I've revised the official Ruby documentation for class MatchData, which is powerful, but (I think) underutilized and often not well-understood.
- Made examples more consistent.
- Added much detail.
- Emphasized captures.
- Added section "What's Here" (bullet lists of methods and their effects).
Check it out:
- Revised (to be in release 4.1, next month): https://docs.ruby-lang.org/en/master/MatchData.html.
- Existing (release 4.0): https://docs.ruby-lang.org/en/4.0/MatchData.html.
Top comments (1)
The new “What’s Here” section sounds especially useful for a class with many related methods. A compact table for unmatched versus empty captures, plus one runnable example for optional and repeated captures, could make the edge cases easier to compare. Did you add a check that executes the examples against current behavior?