A module provides a means of grouping together classes, methods and constants.
This is advantageous for two reasons:
Lets see this in action with a simple example:
We create a module called TextStatistics, in a file called text_statistics.rb, which we place in the lib directory.
self.body.scan(/\w+/).size end self.body.scan(/./).size end end
We can then "mixin" this module into both our classes.
allowing us to write code like this