All I'd Wanted to Know about Ruby's Object Model Starting Out...and Mooar!!!
summary
Work-through of the CRuby source shows how Ruby represents every object as pointers to structs (RBasic, RObject, RClass), what lives in those fields—flags, the C-level klass pointer, method table and super—and how bootstrap code (init_vm, rb_define_class_id, make_metaclass) actually builds classes. The surprising detail: defining one class spawns multiple meta- and method-classes (about five in the example) and include inserts special include classes into the inheritance chain, producing the tangled singleton/meta class chain that Ruby's class/super methods then selectively hide.
AI-written summary · about
chapters (14)
- 0:00Introduction to Ruby
- 1:06The Ruby creation myth
- 2:53The object hierarchy
- 3:55Introspection and self-discovery
- 6:08Singleton methods and classes
- 6:58Class methods and meta-classes
- 8:47C Ruby internal representation
- 10:39Method dispatch mechanics
- 12:17Bootstrapping and class creation
- 14:15Metaclass creation details
- 15:53The metaclass inheritance chain
- 18:31Singleton class implementation
- 21:25Modules and include classes
- 24:44Q&A and conclusion
related talks
29mAll I'd Wanted to Know about Ruby's Object Model Starting Out...and Mooar!!!
34mAll I'd Wanted To Know About Ruby's Object Model Starting Out...And Mooar!!!
36mMetaprogramming? Not good enough!
33mVenturing into the Spooky Science of Ruby
49mThe Well-Grounded Nuby
29mMessenger: The (Complete) Story of Method Lookup
41mWhat is an object, really? OR When is an object actually a function?
28mDeep Ruby
