Metaprogramming in Ruby

Some patterns, approaches, and “spells” for metaprogramming in Ruby.

Aug 20, 2017 · 1 min read

What is metaprogramming?

Here's a definition from Metapgramming Ruby 2:

Metaprogramming is writing code that manipulates language constructs at runtime.

Unlike in C, which has a distinction between compile time (language constructs available) and runtime (machine code), Ruby doesn't have compile time at all. Most Ruby constructs are available at runtime making it a very metaprogramming friendly language.

Below are my notes in the form of Ruby metaprogramming patterns, approaches, and “spells” inspired by Metapgramming Ruby 2.

 

From gist.github.com/BrianSigafoos

Visit homepage
comments powered by Disqus