Forum: Ruby Modules and Mixins

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
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:
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.