forked from xtrahuman/catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
50 lines (46 loc) · 1.13 KB
/
app.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
require_relative './functions/game_function'
require_relative './functions/album_function'
require_relative './functions/book_function'
require_relative './functions/global'
class App
def initialize
@preserve = GlobalFunction.new
@games = @preserve.load_data('games')
@game_list = GameFunction.new(@games)
@albums = @preserve.load_data('musicalbum')
@album_list = AlbumFunction.new(@albums)
@books = @preserve.load_data('books')
@book_list = BookFuction.new(@books)
end
def get_num(option)
case option
when '1'
@book_list.list_all_books
when '2'
@album_list.list_albums
when '3'
@game_list.list_all_games
when '4'
@album_list.list_genres
when '5'
@book_list.list_all_labels
when '6'
@game_list.list_all_authors
end
end
def add_num(option)
case option
when '7'
@book_list.add_book
when '8'
@album_list.add_music_album
when '9'
@game_list.add_game
end
end
def save
@preserve.save_data('musicalbum', @albums)
@preserve.save_data('games', @games)
@preserve.save_data('books', @books)
end
end