Lição 9.Deletar.boa tarde alguém poderia me ajudar nessa lição?


#1

movies = {
Memento: 3
}
puts "What is your favorite movie?"
choice = gets.chomp

case choice
when "add"
puts "Please enter a movie title."
title = gets.chomp
if movies[title.to_sym] = nil
puts "What rating will you give it? (pick number 1-5)"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
puts "The movie #{title} has been added with a rating of #{rating}."
else
puts "That movie already exists!"
end
when"update"
puts "Updated!"
when "display"
movies.each do |movie, rating|
puts "#{movie}: #{rating}"
end
when "delete"
puts "Que filme voce gostaria de deletar?"
title = gets.chomp
if movies[title.to_sym].nil?
puts "Filme não encontrado!"
else
movies.delete(title.to_sym)
puts "#{title} foi deletado."
end
else
puts "Error!"
end
puts movie