Metaprogramming and Ruby Internals for Rails Programmers

Location: E145 - E146 Level: Expert
Average rating: ***..
(3.80, 20 ratings)

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.

Patrick Farley


Patrick Farley is a developer and occasional tech lead with ThoughtWorks. He blogs on Ruby and Rails at

News and Coverage
co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Sun Microsystems
  • FiveRuns
  • GotThingsDone
  • Heroku
  • ThoughtWorks
  • Atlantic Dominion Solutions
  • Blue Box Group
  • CodeGear
  • E-xact
  • ELC Technologies
  • EnterpriseDB
  • GemStone Systems
  • Intridea
  • Morph Labs
  • RightScale
  • TechRepublic

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media and Promotional Opportunities

Download the Media & Promotional Partner Brochure (PDF) for more information on trade opportunities with O'Reilly conferences, or contact mediapartners@

Program Ideas

Post your suggestions for speakers, topics, and activities on the RailsConf wiki or send an email to

Press and Media

For media-related inquiries, contact

Contact Us

View a complete list of RailsConf 2008 contacts.