+ 2
What is this used for?
5 Antworten
+ 6
modules make difference for the same name methods in same name classes. if one of these same name methods are under a module, Ruby will now know, which one of them you want to use.
+ 2
not so much actually, go and read ruby's documentation and it will becomes more clear. nothing so big.
+ 1
it is confusing
+ 1
Modules are used for two things. One is namespacing, to avoid name clashing between methods and classes. The other is mixins (A way to achieve something similar to multiple inheritance. Think of java interfaces. Modules solve the same problem in a different way).
0
thanks