The Memento Pattern

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

http://www.betterruby.com/gangs-in-ruby-remember-me/

2 Likes

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 post.save as a parameter. The method should be able to handle the object itself and do the saving internally.

1 Like