Posts Tagged “meta-programming”
An old gem that's been lying around untouched since 2010 got some refactoring love. Moving away from brutally monkey patching a core class, I used this case as an academic example to illustrate how to test refinements using Test::Unit, MiniTest::Spec and RSpec.
2016-03-11 Including a Module. With Parameters!
The Ruby include statement only allows for one type of argument: the module constant(s) to include. I've found myself in a situation where I wished I could make the include statement more dynamic, like passing extra arguments that influence the module to be included. This article describes how to use a module factory to achieve exactly that.