Visiting objects
The visitor pattern is most commonly used when you have many objects of separate classes that you need to handle in some manner. You have a class called a visitor that processes, or visits, each object and does something with the object. Often when using the visitor pattern, you actually have multiple different types of operations that all need to deal with the same objects, so you have multiple visitor classes. However, you do not want to add methods for each visitor class to each of those separate classes. After all, while it is possible to define methods on any class in Ruby, it's generally considered bad practice to define methods on classes that are not part of your library, unless that is the sole purpose of your library.
The visitor pattern is a way around the problem of defining per-visitor methods in each class that is being visited. A classic approach to the visitor pattern results in a ton of complexity and still requires adding a method to the classes...