-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rb
More file actions
36 lines (30 loc) · 768 Bytes
/
main.rb
File metadata and controls
36 lines (30 loc) · 768 Bytes
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
require_relative './call_action'
class Main
def initialize
@choice_action = CallAction.new
end
def main()
puts 'Welcome to School Library App!'
@choice_action.load_data # call a method that load data from file
loop do
puts "\n"
options = [
'1 - List all books', '2 - List all people',
'3 - Create a person', '4 - Create a book',
'5 - Create a rental',
'6 - List all rentals for a given person id',
'7 - Exit'
]
puts options
choice = gets.chomp.to_i
if choice == 7
@choice_action.preserve_data
puts 'Thank You for using this app!'
exit 0
end
@choice_action.call_action(choice)
end
end
end
main_app = Main.new
main_app.main