metaprogramming

RUBYOPT and the Sneaky Shim

You need to insert a compatibility shim, diagnostics, or tracing code into a Ruby process… but you don’t have control over how the program is started. What do you do?

Meta Ruby

Learn to use Ruby's rich metaprogramming capabilities to augment the language - safely and sustainably.

Module Prepend

Sometimes you need to attach new functionality, such as logging, to other people’s code. Learn to leverage Ruby’s ancestor chain for (relatively) clean patching, using prepended modules!

Send Variations

Sometimes you need to invoke a method whose name you won’t know until runtime. In this episode, you’ll learn the differences between #send, #public_send, and #__send__, gotchas of using them, and when to use each one.

Module Builder Pattern – Part 2

Join guest Chris Salzberg as he demonstrates how to implement a foundational Ruby metaprogramming technique: the Module Builder pattern.

Module Builder Pattern – Part 1

Love it or hate it, metaprogramming is an undeniable part of Ruby programming lore and culture. In part one of two, join guest chef Chriz Salzberg in exploring how how Ruby modules are instances of a class just like anything else… and just like any object, they can be customized!

Bindings and Local Variables

Learn how to use the power of Ruby’s Binding objects to take precise control of the environment code is executed within!

Dynamic Inspect

When it comes to debugging, you can fight with Ruby’s dynamic nature… Or you can embrace it. A little just-in-time metaprogramming can give you a clear window into unexpected behavior.

Mixed Argument Struct

Ruby is all about giving coders choices. What if you could give users of your code the choice between positional or keyword arguments, or some mix of the two? Let’s learn how!

Dynamic Understanding of Dynamic Systems

Ruby’s open core classes can be modified at any time by any code you load. But this dynamism can work for you as well. Join guest Paul Stefan Ort for a lesson in how to use Ruby to discover exactly what changes a RubyGem makes to core classes.