Meta-programming for Dummies
summary
Explains practical Ruby metaprogramming: uses attribute_accessor and ActiveRecord’s runtime column injection, builds a workflow gem–style DSL that replaces dozens or hundreds of hand-written state methods and shows it working, and applies metaprogramming to solve repeating tasks across 20–30 models. Emphasizes concrete APIs used (instance_methods, define_method, class_eval), testing and documenting generated behavior, and specific pitfalls—most notably avoid method_missing unless carefully paired with respond_to_missing? and strong tests.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:26Why metaprogramming
- 2:35Definition
- 4:45ActiveRecordBase
- 8:49Summary
- 9:22Start method opening
- 10:14Modify behavior
- 12:02Integrate
- 12:58Keep it independent
- 14:29Readability
- 17:04Risks
- 17:43Questions
related talks
26mMeta-programming for Dummies
18mMetaprogramming: Unraveling the Magic
31mSeeing Metaprogramming and Lambda Function Patterns in Ruby
25mIn Defense of Ruby Metaprogramming
28mDiving into Dynamic: Demystefying Metaprogrammaing with Ruby
38mMy Meta Moments
34mMetaprogramming for generalists
33mMetaprogramming Isn't Real, It Can't Hurt You
