This repo contains various examples of common design patterns for Object Oriented Programming written in Ruby. The goal is to show how to implement these patterns with Ruby which is dynamically typed, doesn't have interface, method overloading and other concepts that are present in a typical object-oriented language.
- Chain of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
You can run each pattern with Ruby. For example:
ruby -r './app.rb' -e 'Singleton::App.new.main'
You can also run tests with RSpec. Tests are provided and located in /spec
.
The examples here are open for improvement so feel free to report issues, add documentations, modify examples and send pull requests.