Join Kevin Skoglund for an in-depth discussion in this video Namespacing, part of Ruby: Classes and Modules.
- [Narrator] In this chapter,…we're going to be learning about Modules.…Modules are wrappers around Ruby code.…And they're different from classes…which are also wrappers around Ruby code…because modules cannot be instantiated.…You cannot have an instance of a module.…You can't call new on it the way you can a class.…So what do we use them for?…Well there are two main reasons,…and we're going to look at both of them.…First, there's namespacing and second,…there's something called mixins.…Let's look at namespacing first.…Namespacing is used to prevent conflicts…when code has similarly named classes and methods.…
Let's imagine a real world example which I'm sure…we've all experienced at some time in our lives.…You've been in a classroom where there's two people…who have the same first name.…It can get a little confusing.…Imagine we have a classroom with two girls named Sophia.…When the teacher says Sophia…to call on them for an answer,…how do we know which one…that they mean to answer the question?…The most common solution…
- Defining a custom class
- Working with instances of a class
- Class and instance attributes and methods
- Class inheritance
- Working with dates and times
- Using modules as namespaces and mixins
- Raising and handling exceptions
Skill Level Beginner
2. Class Attributes and Methods
4. Dates and Times
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.