🗃️ OOP Design Patterns Ruby Examples
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.
Creational Design Patterns
Structural Design Patterns
Behavioral Design Patterns
- Chain of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
Usage and Testing
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
.
Contributing
The examples here are open for improvement so feel free to report issues, add documentations, modify examples and send pull requests.