The Memento Pattern

Here’s an article on implementing the Memento pattern in Ruby.


Interesting pattern. I rewrote the code examples in pure Ruby objects of Struct and Hash. You can see my example on a comment in the blog post.

One thing I don’t like in his example use the use of as a parameter. The method should be able to handle the object itself and do the saving internally.

1 Like