-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_input.rb
48 lines (45 loc) · 875 Bytes
/
check_input.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
require './album/music_album_main'
require './book/book_main'
require './game/game_main'
require './app'
class CheckInput
def self.check_input(input, app)
case input
when 1..6
list_all(input, app)
when 7..9
create_options(input, app)
when 10
puts 'Goodbye! 👋'
raise StopIteration
else
puts 'Please enter a valid input:'
end
end
def self.list_all(input, app)
case input
when 1
app.list_books
when 2
app.list_music_albums
when 3
app.list_games
when 4
app.list_genres
when 5
app.list_labels
when 6
app.list_authors
end
end
def self.create_options(input, app)
case input
when 7
CreateBook.create_book(app)
when 8
CreateMusicAlbum.create_music_album(app)
when 9
CreateGame.create_game(app)
end
end
end