Hitchhiker's Guide to Metaprogramming: Class/Module Hooks

I've written another article for Rubysource.

In it I cover some of Ruby's class/module hook, as well as some of the basic tenents of metaprogramming. This is the first of several post I plan on writing up on the topic. You should go and check it out if you have a minute.

If you are here from Rubysource...

I've linked from Rubysource to this blog to provide some additional reference material. Below you'll find some of the resources that helped me to better understand metaprogramming. Be sure to subscribe to "Run With It" (via RSS or email) to keep up to date with this series. ^_^ →


  • Ruby Rogues 012 - Referenced in the post. Great discussion on what constitues metaprogramming, and some of the best practices you'll want to know in order to use them properly.
  • Dave Thomas's talk on metaprogramming - Referenced in the post. Amazing screencast by Dave Thomas(@pragdave). Given in 2007, it is still my favorite intro piece on metaprogramming.
  • Rubylearning - Another great reference for learning to metaprogram. Be sure to check out Study 3, as it directly relates to the hooks covered in the post.
  • Paolo Perrotta Metaprogramming Ruby - Paolo Perrotta gives great insight into metaprogramming in Ruby.
  • John Nunemaker on include/extend - Good article on include vs extend.
  • Wiki entry on Metaprogramming - Suprisingly detailed wikipedia article on metaprogramming. Not directly applicable to Ruby, but a good read.

If you have any questions feel free to send me a message or leave a comment (here or on Rubysource). Also, there will likely be more references in the next part of Hitchhiker's Guide to Metaprogramming.

blog comments powered by Disqus