Metaprogramming and Ruby Internals for Rails Programmers
Without a strong understanding of the Ruby language, Rails developers are risk a life of programming by accident. The same danger applies to Ruby programers that makes frequent use of Ruby’s metaprogramming facilities without a strong conceptual understanding of the Ruby object model. One of the best ways to facilitate this sort of understanding is through reading Ruby source.
Covering all the details, exceptions, and interesting corners of Singleton classes, Metaclasses, Mixins, and the Ruby object model in a 45 minute session is certainly overreaching. What can be attained is a basic familiarity with the possibilities these language features open up to Rails developers. A survey of Ruby source also serves as the basis of a general understanding and eases the way for further investigation when detailed questions arise.
This session will begin with interesting metaprogramming examples from production Rails applications as well as some borrowed form popular open source projects. The talk will include extracts from MRI source code, discussion, and visualizations of:
Method dispatch Singleton classes Metaclasses as a special case of the Singleton class Mixins, Include classes, and Inheritance chain manipulation Object, Module, and Class and their place in the Ruby object model
Extracts from JRuby will also be included to offer an alternative language for exploring internals, as well as to point out the many similarities in implementation.
People planning to attend this session also want to see:
Patrick Farley
ThoughtWorks
Patrick Farley is a developer and occasional tech lead with ThoughtWorks. He blogs on Ruby and Rails at www.klankboomklang.com























