Forum: Ruby Modules and Mixins

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D56a7d2ddfc07e6cdb9d7ec801d0e6b0?d=identicon&s=25 Rajkumar Kethavath (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
how
to use them.??
Example of each is appreciated.

Thanks in advance.
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (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:

https://www.tutorialspoint.com/ruby/ruby_modules.htm
This topic is locked and can not be replied to.