Forum: Ruby Modules and Mixins

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D856bc2dc241dee60501cbe828b0b2c4?d=identicon&s=25 Rajkumar K. (rajkethavath)
on 2017-01-23 03:39
Hi All,  I am a very newbie to ruby programming. Can anyone help me in
understanding the basic difference between Module and Mixin. When and
to use them.??
Example of each is appreciated.

Thanks in advance.
3a81ced4012650ca2004c9bff7b18202?d=identicon&s=25 Ronald F. (rovf)
on 2017-01-23 13:55
Module is a datatype. Mixin is a concept. In this respect, it doesn't
make sense to talk about how they "differ". You could equally ask about
the difference between a brush and the art of painting a picture.

Of course, the two terms are *related*, because if you want to implement
a mixin, an obvious tool would be a module.

If you want to learn how to create mixins, there are plenty of tutorials
available, which you can easily find using Google. I find this one quite
suitable as a starting point for beginners:
This topic is locked and can not be replied to.