Chapter 9. Metaprogramming

image with no caption

Metaprogramming becomes much easier to understand once you learn how Ruby implements it internally.

One of the most confusing and daunting subjects Ruby developers face is metaprogramming. Metaprogramming, as indicated by the prefix meta, literally means to program at a different or higher level of abstraction. Ruby provides many different ways for you to do this, allowing your program to inspect and change itself dynamically. In Ruby, your program can change itself!

Some of Ruby’s metaprogramming features allow your program to query for information about itself—for example, information about methods, instance variables, ...

Get Ruby Under a Microscope now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.