Using Ruby's extensibility features
One of the great aspects of Ruby is that even if you don't explicitly design your library for extensibility, the language itself offers ways to make the library extensible. Using the built-in language features directly makes it possible to extend a library, even if the library itself wasn't designed for extensibility.
Ruby has many ways to modify the behavior of objects. Other than the immediate objects, which we discussed in Chapter 1, Getting the Most out of Core Classes, and objects that are frozen and cannot be modified, all Ruby objects support extension by modifying the object's singleton class.
Commonly, libraries will define methods in classes. Let's say you are designing a Ruby library to manage books and users for physical libraries (those that lend out books such as this book). The physical library has many users, most of whom check out books on a regular basis. For each user, you want to track the books...