Join Kevin Skoglund for an in-depth discussion in this video Limiting input, part of Ruby Essential Training.
In the last movie we enabled our Guide class to be able to handle user input.…In this movie, I'd like to improve that a little further by restricting the data…that will allow the user to give us.…The thing that I am mostly concerned about is that we are accepting any response…from the user here and passing it right away off to the action.…And the action is handling it appropriately.…The action, if it doesn't fit one of these categories, comes up and says, …"oh! I don't understand that command."…But I think it's better software design if we actually trap it before we try and do the action.…Let's make sure we got valid input before we run off and try and do it.…
The other one works.…There's no reason that that's wrong.…You can do it that way, but I think it's a slight improvement and it will also…give us a place to make some more improvements a little later on.…So, let's go ahead and make that change. What I want to do is make a new…method called get action, and I am just going to right now move these two…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- 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.