Mixins

Ruby has a feature of single inheritance only. Ruby has classes as well as modules. A module has methods but no instances. Instead, a module can be mixed into a class, which adds the method of that module to the class. It is similar to inheritance but much more flexible.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *