Join Kevin Skoglund for an in-depth discussion in this video Challenge: To-do list, part of Ruby: Classes and Modules.
- [Instructor] It's time for another coding challenge.…In this challenge we're going to apply…what we've learned about modules…in order to define a new class called ToDoList.…And that class is going to mix in Ruby's…built-in module called Enumerable.…There are a number of Ruby classes…that make use of the Enumerable module,…array, hash and range, for example.…All of these have the ability to enumerate…the items that are in there,…and perform a number of different behaviors on those items.…But that Enumerable module…is not just limited to Ruby's use.…
We can make use of it, too,…and that's what we want to do here.…We want to take the Enumerable module…and use it in our custom class.…Once we do that, we gain a lot of those behaviors…that are in the Enumerable module.…For example, there are methods for counting the items,…we could use include to find out…if an item is included in the set.…We can use map, find, reject, inject,…all of those methods that we normally use…with arrays, hashes and ranges,…suddenly become available in our custom class.…
- 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.