You can think of a module as a toolbox that contains a set methods and constants. There are lots and lots of Ruby tools you might want to use, but it would clutter the interpreter to keep them around all the time. For that reason, we keep a bunch of them in modules and only pull in those module toolboxes when we need the constants and methods inside!
You can think of modules as being very much like classes, only modules can’t create instances and can’t have subclasses. They’re just used to store things!
Check out our example module in the editor. See how it has an approximation of pi stored in
PI and a series of methods for calculating the circumference and area of a circle?
Click Next to continue.