Today we tackle one of Ruby's most controversial new features. Building on the example from episode #249, we'll look at how to extend a core class with custom methods, without …
Tag: metaprogramming
Episode #226: Evil Monkeys
In which I rant a bit about the dangers of "monkey-patching".
Episode #221: Def Return Value
Since Ruby 2.1, def returns a symbol. In this episode we'll take a look at why this matters, and how it might change the way we define methods.
Episode #182: Macro
When is it appropriate to metaprogram? Today's episode looks at one situation in which it may be a good choice.
Episode #091: Ruby 2.0: Rebinding Methods
In this, the first (but far from the last!) RubyTapas episode to focus on a Ruby 2.0 feature, we look at the implications of Ruby's newly relaxed rules for binding …
Episode #048: Memoize
This episode covers how to write a "macro"-a method that generates or modifies other methods-using the classic example of memoizing method results.
Episode #028: Macros and Modules, Part 2
In episode 27, we switched from adding generated methods directly to a class, to using anonymous modules. In this episode, we consolidate our metaprogramming modules, and make them more self-documenting.
Episode #027: Macros and Modules
In this episode, we look at how to use dynamically generated modules to make metaprogrammed methods open for future extension.
Episode #006: Forwardable
A short introduction to using Ruby's Forwardable library for object composition.