Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

A Walk Through the Ruby Object Model

By Peter Cooper / March 6, 2009

rom.png Vidar Hokstad is the writer behind the fine Writing a Compiler in Ruby series, but he's taken a break to explain the structure and semantics of the Ruby object model. It's a fine walkthrough.

Vidar takes us through what objects really "are" (a bundle of things, such as a reference to a class, a table of instance variables, and a set of flags) but also explains the exceptions (for example, FixNums, nils, true, false, and symbols are represented "natively" in the 32-bits where a pointer to an object's metadata would usually be stored - this is one of the reasons why symbols are so efficient).

Going further, Vidar walks through class relationships (including metaclasses/virtual classes) modules, message sending, and method_missing.

Other Posts to Enjoy

Twitter Mentions