Unit 02 of 02
Metaprogramming
Querying objects at run time, defining methods with code that writes code, proxy objects that catch missing methods and their risks, and building domain-specific languages with declarative interfaces.
Published Updated
Lessons
- 01 Reflection Measuring how to ask an object about its own methods, state and type at run time, and how those questions classify who wrote a method. 14 min read
- 02 Dynamic Method Definition Measuring how define_method produces methods at run time, how those methods check their parameters, and how the production classifies the author. 10 min read
- 03 Catching Missing Methods Measuring what Ruby does when a message has no definition, how a class catches it with method_missing, and what reflection reports about the catch. 15 min read
- 04 Domain-Specific Languages Measuring which author hides behind a declaration line such as field :price, 0, where class methods are looked up, and where the block form breaks. 7 min read