Join Kevin Skoglund for an in-depth discussion in this video Solution: Secure radio, part of Ruby: Classes and Modules.
- [Instructor] I hope that you were able to complete…the secure radio challenge.…In this movie,…I'm going to show you the solution that I came up with,…and you can either compare yours against mine,…or if you ran into problems,…you can use my solution as a guide to get you back on track.…Let's start by looking at that ShiftCipher class…that's going to do our encryption for us.…So you can see that I've got…a class variable here for upcase…and I've used that shorthand notation here…with the asterisk and a range after it…inside the square brackets.…I'm just going to copy that.…Let's go to IRB and just show you what that does.…
So I go to IRB and I paste it in.…You see it expands it out to a full array…of all those characters.…It just saves me a lot of typing.…It's a handy trick.…And I'm doing the same thing for downcase…with the lowercase letters.…So from capital A to capital Z,…from lowercase a to lowercase z.…I now have two sets.…So then I have encode and decode.…Let's look at encode first.…It is a class method.…We know that because it has self in front of it.…
- 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.