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 how to use them.?? Example of each is appreciated. Thanks in advance.
on 2017-01-23 03:39
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: https://www.tutorialspoint.com/ruby/ruby_modules.htm