forked from leehaney254/Catalog-of-my-things
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
68 lines (64 loc) · 1.25 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
67
68
require './app'
def main(app)
puts 'This a catalog of my things'
puts
loop do
case menu
when 1
app.list_books
puts
when 2
app.list_music_album
puts
when 3
puts 'List of games'
app.list_games
puts
when 4
app.list_genre
puts
when 5
app.list_labels
puts
when 6
puts 'List all authors (e.g. \'Stephen King\')'
app.list_authors
puts
when 7
app.add_book
puts
when 8
app.add_music_album
when 9
puts 'Add a game'
app.create_game
when 10
app.save_to_files
puts 'Thank you for using this App👋❌'
exit
else
puts 'Please select an option between 1 and 10'
end
end
end
def menu
puts 'Select a number'
list = {
1 => 'List all books',
2 => 'List all music albums',
3 => 'List of games',
4 => 'List all genres (e.g \'Comedy\', \'Thriller\')',
5 => 'List all labels (e.g. \'Gift\', \'New\')',
6 => 'List all authors (e.g. \'Stephen King\')',
7 => 'Add a book',
8 => 'Add a music album',
9 => 'Add a game',
10 => 'Exit App'
}
list.each do |index, string|
puts "#{index} - #{string}"
end
gets.chomp.to_i
end
app = App.new
main(app)