-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.rb
66 lines (60 loc) · 1.19 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require_relative './classes/views/music_album_view'
require_relative './classes/views/genre_view'
require_relative './classes/game_app'
require_relative './classes/book_app'
def run_first(option)
case option
when 1
BookApp.list_all_books
when 2
MusicAlbumView.all
when 3
GameApp.list_games
when 4 # list
GenreView.all
when 5
BookApp.list_all_labels
when 6
GameApp.list_all_authors
else
run_second(option)
end
end
def run_second(option)
case option
when 7
BookApp.create_book
when 8
MusicAlbumView.add
when 9
GameApp.add_game
else
puts 'Command Not Found'
end
end
def ask_option
options = [
'',
'Please select an option by entering the following number:',
'1. List all books',
'2. List all music albums',
'3. List of 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',
'0. Exit'
]
puts options
choice = gets.chomp.to_i
return puts 'Thank you for using the app' unless choice != 0
run_first(choice)
ask_option
end
def main
puts 'Welcome to the Catalog of my things app'
ask_option
end
main