Just when you thought you couldn’t refactor any more…
summary
A real refactor: starts from brittle starts_with checks and iterates to a working YouTube URL parser that returns type plus ID or name. Shows concrete tools: String#match?, MatchData#named_captures, Regexp#===, Enumerable#find and Enumerator.new, and explains why patterns repeat and how named captures plus find+break remove duplication. Builds successive versions, culminating in a compact enumerator-based parser that is correct, complete and demonstrably executable.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 0:44Format
- 4:49Start with
- 7:08StringMatch
- 9:36TripleEqual Operator
- 11:53Regular Expressions Capture
- 14:32Named Captures
- 18:11enumerable
- 21:31Break
- 26:09numerator new
- 29:52outro








