20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/new_games/cli.rb', line 20
def
input = nil
while input != "exit"
puts "----------------------------------------------"
puts "Which game would you like to know more about?"
puts ""
puts "Type the number that matches the game"
puts ""
puts "Type list to see the list again"
puts "Type exit to end the program"
puts "----------------------------------------------"
input = gets.strip
if input == "list"
list
elsif input.to_i.between?(1, Game.all.size)
game = Game.find(input)
puts " Name: #{game.title}"
puts " Date: #{game.date}"
puts " Price: #{game.price}"
puts " Publisher: #{game.publisher}"
elsif !input.to_i.between?(1, Game.all.size)
puts "Invalid number. Please type a valid number"
else
"goodbye"
end
end
puts "Come back to see a list of upcoming Xbox One games"
end
|