-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.rb
44 lines (41 loc) · 1.13 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
require_relative 'app'
OPTIONS = {
'1' => 'List all books',
'2' => 'List all Music albums',
'3' => 'List all Games',
'4' => 'List all genres',
'5' => 'List all labels',
'6' => 'List all Authors',
'7' => 'Add a book',
'8' => 'Add a music album',
'9' => 'Add a Game',
'10' => 'Quit'
}.freeze
def main
app = App.new
puts '==================================================='
puts "\nWelcome to Catalog of my things applpication\n\n"
puts '==================================================='
loop do
puts 'Select an option to continue'
OPTIONS.each { |index, string| puts "#{index} - #{string}" }
user_option = gets.chomp.to_s
case user_option
when '1' then app.list_books
when '2' then app.list_music_albums
when '3' then app.list_games
when '4' then app.list_genres
when '5' then app.list_labels
when '6' then app.list_authors
when '7' then app.add_book
when '8' then app.add_music_album
when '9' then app.add_game
when '10'
puts 'Bye bye, see you again!'
exit
else
puts 'Invalid option, please select a number between 1 and 10'
end
end
end
main