The visitor pattern lets you define new operations on an existing hierarchical data structure without changing the structure.

Of course, in relatively static languages where changing the code is a big deal, the visitor pattern makes some sense. I’m not sure how useful it is in Ruby: if you need to add an operation to some class or classes in Ruby, well, you just add the operation. Ruby means never having to say, “I’m sorry that class is closed.” The visitor is perhaps my all time least favorite GOF pattern, more like a problem than a solution.