BT

Your opinion matters! Please fill in the InfoQ Survey!

InfoQ Presentation: MetaProgramming Ruby

| by Werner Schuster Follow 4 Followers on Dec 07, 2007. Estimated reading time: less than one minute | NOTICE: The next QCon is in London Mar 5-9, 2018. Join us!

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Metaprogramming is one of the technologies used to implement some distinctive Ruby on Rails features such as has_many. In this presentation, Dave Thomas (PragDave) focuses on the Ruby features that make metaprogramming possible:
  • Class definitions are active - they get executed
    This allows to execute custom code when a class gets first loaded.
  • All method calls have a receiver, i.e. a self object
    A crucial fact in Ruby - Dave explains how self some methods of metaprogramming work with manipulating self.
  • Classes are objects too
  • Open and singleton classes - it's always possible to add members to classes
Other topics include how to use eval flexibly with bindings and more.

Check out "MetaProgramming Ruby".

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

This is cool!!! by Jure Srsen

Tnx. It would be really nice if more Ruby presentations like this would be available.

eph by Andrei Zinca

An otherwise good presentation ruined by an awful, macabre joke.

problems by jimmy coyne

Is any body else having problems viewing this presentation?

Re: problems by Sean Cribbs

+1

Re: problems by johan andries

On Windows, for me it works in IE but not in FireFox.

able to download this? by Hrafn Nordhri

Are we able to download this?

Re: This is cool!!! by Dilya Han

You can watch Dave's other talk about Metaprogramming in ruby on YouTube here. YouTube also has many others talking about metaprogramming as well.

Also, there is a great Video Course about "Ruby Metaprogramming" here as well. Well worths its' price.

Disclaimer: I did peer review for the course. So, the author gave me $100 OFF coupon that I added to the URL above as well.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

7 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT