BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News InfoQ Presentation: MetaProgramming Ruby

InfoQ Presentation: MetaProgramming Ruby

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
Style

BT