Diving into Dynamic: Demystefying Metaprogrammaing with Ruby
summary
Shows how a wrapper reads a data_source that exposes methods like cpu, mouse, keyboard and either generates 100+ accessors with define_method or handles calls dynamically with method_missing/respond_to_missing to flag component prices > $99. Demonstrates using public_send (not send), explains method lookup order, warns about monkey patching, memory/performance cost of runtime generation, and recommends explicit tests and docs; example code compiles and runs in demo.
AI-written summary · about
chapters (9)
- 0:00Introduction and motivation
- 2:28What is metaprogramming
- 6:42Dynamic dispatch with send
- 10:21Creating methods at runtime
- 12:08Method lookup and method_missing
- 14:39Open classes and monkey patching
- 16:48Metaprogramming in Ruby on Rails
- 17:51Trade-offs and best practices
- 20:24Q&A session







