Hijacking Ruby Syntax in Ruby
summary
Demos show concrete hacks: using Binding to read and set local variables at runtime, using TracePoint to rewrite return values and detect class-definition end, and using Refinements to add top‑level helpers safely. Implementations include gems that enforce Java‑like modifiers (final, override, abstract), a table‑style testing DSL, a with/deferral API that mimics Go’s defer, and Ripper+TracePoint to map tokens to semantic context. Warning: TracePoint can break or persist and makes debugging painful.
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 3:33Working with bindings
- 6:49Mastering TracePoint
- 10:15Method hooks and modifiers
- 14:25Advanced code analysis
- 19:05Metaprogramming techniques
- 24:41Resource management gems
- 29:38Conclusion and reflections
related talks
39mSteal This Talk: The Best Features Ruby Doesn't Have (Yet)
30mRuby Techniques by Example
37mImplicit to Explicit: Decoding Ruby's Magical Syntax
32mStupid Ruby Tricks
38mDispelling the dark magic: Inside a Ruby debugger
48mKeeping Ruby Reasonable
30mExtending Ruby with Ruby
43mThe joy of Ruby debugging - Pry universe
