Control methods like a pro: A guide to Ruby's awesomeness, a.k.a. metaprogramming
summary
Shows that methods are objects and gives exact recipes: list methods, use method/instance_method to fetch Method and UnboundMethod, bind or unbind, inspect parameters and source_location, and redefine by remove_method/define_method while preserving privacy. Builds a tiny_hooks library that implements before/after/around hooks for instance and class methods, binds unbound originals when needed, and benchmarks as tiny_hooks 1.6× faster than Active Support callbacks, so the hook approach actually works.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:55Many tests
- 6:05Part 1 No
- 6:35Part 2 No
- 7:23Methods that list methods
- 9:31Methods that fetch method
- 11:20Method objects
- 11:44Method classes
- 16:20Logic class
- 19:05Definition
- 19:20Methods
- 22:50TinyHooks
- 27:46Conclusion








