Modules are an extremely powerful utility when coding in Ruby. Modules allow you to add behavior to classes, hold constants, add namespaces, and more.
What you'll learn
- Modules
- Methods
- Class Methods
- Include and Extend
- Magic Methods in Ruby
Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.
Modules are an extremely powerful utility when coding in Ruby. Modules allow you to add behavior to classes, hold constants, add namespaces, and more.
In this stage, is to introduce the basics of working with modules in Ruby as well as give the students brief exposure to more advanced topics with modules.
Chevron 6 steps1:47
4 questions
3:35
1 objective
4:58
2 objectives
In this stage, we'll learn about some of the modules that are included as part of the Ruby core distribution.
Chevron 6 steps5:14
2 objectives
4:05
3 objectives
7:49
2 objectives
Ruby Modules give you two different ways to augment behavior: Include and Extend. In this stage, we'll learn about the differences between the two as well as how to use them when creating our own modules.
Chevron 6 steps3:05
2 objectives
5:42
1 objective
6:17
1 objective
Now that we now how modules work, we’re going to write a simple program that simulates keeping inventory at a small retail store. The store sells shirts, pants, and accessories. We’re going to put everything together using modules, include, extend, and friends. Make sure to follow along using Workspaces.
Chevron 10 steps3:37
2 objectives
3:10
2 objectives
4:14
1 objective
6:24
1 objective
4:30
1 objective
Get personalized course recommendations, track subjects and courses with reminders, and more.