Tag Archives: mixins

Ruby Require VS Load VS Include VS Extend

Here are the differences between Require, Load, Include and Extend methods: Include When you Include a module into your class as shown below, it’s as if you took the code defined within the module and inserted it within the class, where you ‘include’ it. It allows the ‘mixin’ behavior. It’s used to DRY up your […]

How to Write a Singleton Class in Ruby

A Singleton is a Design Pattern which is used to prevent a class from being instantiated more than once. So there can only be one object of that particular type of class. Writing a Singleton Class in Ruby is very easy and much more straight forward than doing it in Java, for example. It uses […]