A very common occurrence - especially when writing a
Module for a library - is knowing when that module has been included or mixed-into another
Ruby provides the
Module.included method to receive callbacks when this happens.
Module.included receives just one parameter, which is the
Class into which your
Module was included. Unlike the callbacks associated with methods where the parameter is a
Symbol, here we receive the actual object representing the
As always, lifecycle callbacks are easiest to teach through exercises, so here is one for you now.