Alert! Please '.capitalize' the title inputs from users


#1

Hi guys! I'm David.

I've just completed 'A Night at the movies' and i'd like to call your attention to the need to use '.capitalize' to well, capitalize user inputs for movie titles.If a user types the titles in lowercase letters, the program reads it as a movie that is not included in the movie hash. Even though you get a pass to the next lesson, I was still kind of worried that sometimes the code didn't perform as expected.

'title = gets.chomp' should be 'title = gets.chomp.capitalize'

The sample code in '1. What You'll Be Building' also has the same problem. If your code doesn't perform as expected, this might be the reason so beware!.

movies = {
Truman: 4,
Excort: 3.5,
The_final_member: 3,
Haze: 4,
Electrify: 3
}
puts "Welcome! What would you like to do today?"
puts "--Type 'add' to add a movie"
puts "--type 'update' to update a movie"
puts "--type 'display' to display movies"
puts "--type 'delete' to delete a movie"

choice = gets.chomp
case choice
when "add"
puts "Title, please."
title = gets.chomp.capitalize
if movies[title.to_sym].nil?
puts "What's the rating?"
rating = gets.chomp