generated from microverseinc/readme-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.rb
37 lines (34 loc) · 900 Bytes
/
options.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
require_relative 'app'
class Options
def initialize
@app = App.new(self)
puts "\n~~ Welcome to school library app ~~\n"
show_menu
end
def conditions(user_response)
if user_response < 7
@app.select_option(user_response)
sleep(1)
show_menu
elsif user_response == 7
@app.select_option(user_response)
puts "\n~~ Thank you for using School Library App ~~\n"
else
puts "\n~~ Please, Insert a valid number ~~\n"
sleep(1)
show_menu
end
end
def show_menu
puts "\nPlease choose an option by entering a number:"
puts "\n1 - List all books"
puts '2 - List all people'
puts '3 - Create a person'
puts '4 - Create a book'
puts '5 - Create a rental'
puts '6 - List all rentals for a given person id'
puts "7 - Exit\n"
user_response = gets.chomp.to_i
conditions(user_response)
end
end