forked from andrianarivo/catalog_of_my_things
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.rb
More file actions
73 lines (68 loc) · 1.34 KB
/
app.rb
File metadata and controls
73 lines (68 loc) · 1.34 KB
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
69
70
71
72
73
# APP CLASS: is in charge for
# includes modules to access their functions
# initializes data from the DataManager
# handles user input with first_run and second_run methods
require 'json'
require_relative 'modules/game_module'
require_relative 'modules/music_album_module'
require_relative 'modules/genre_module'
require_relative 'modules/author_module'
require_relative 'modules/book_module'
require_relative 'modules/label_module'
require_relative 'data_manager'
class App
include GameModule
include MusicAlbumModule
include GenreModule
include AuthorModule
include LabelModule
include BookModule
include DataManager
def initialize
@items = []
load_games
load_music_albums
load_books
load_genres
load_labels
load_authors
end
def first_run(option)
case option
when 1
list_books
when 2
list_music_album
when 3
list_games
when 4
list_all_genres
when 5
list_labels
when 6
list_authors
else
second_run(option)
end
end
def second_run(option)
case option
when 7
create_book
when 8
create_music_album
when 9
create_game
when 10
create_genre
when 11
create_label
when 12
create_author
else
save_files
puts 'Thank you for using this app!'
exit
end
end
end