Ruby Metaprogramming Episode 3: Dynamic Code

Posted in Development on July 12, 2008


Ruby Metaprogramming Episode 3: Dynamic Code

Metaprogramming is sometimes defined as “writing code that writes code.” Here we’ll see just how to do that in Ruby.

  • Blocks and the two kinds of block-objects
  • How bindings capture execution context
  • How blocks can act as closures, and why that’s vital to metaprogramming
  • Writing methods that define other methods using nested defs
  • Using define_method
  • Writing your own accessor methods

Watch Video

Tags: Ruby, Metaprogramming, The Pragmatic Programmers, Ruby Metaprogramming