-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprompt_handlers.rb
68 lines (47 loc) · 1.38 KB
/
prompt_handlers.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module PromptHandlers
def prompt_option(text, options)
puts "\n***SELECT***\n\n"
options&.each_with_index { |option, index| puts "#{index} - #{option}\n" }
prompt(text)
end
def prompt_book_details
puts "\n***ENTER BOOK DETAILS***\n\n"
publish_date = prompt('Publish date')
publisher = prompt('Publisher')
cover_state = prompt('Cover state')
[publish_date, publisher, cover_state]
end
def prompt_music_album_details
puts "\n***ENTER MUSIC ALBUM DETAILS***\n\n"
publish_date = prompt('Publish date')
on_spotify = prompt('Album on Spotify [Y/N]')
[publish_date, on_spotify]
end
def prompt_game_details
puts "\n***ENTER GAME DETAILS***\n\n"
publish_date = prompt('Publish date')
multiplayer = prompt('Multiplayer')
last_played_at = prompt('Last played at')
[publish_date, multiplayer, last_played_at]
end
def prompt_genre_details
puts "\n***ENTER GENRE DETAILS***\n\n"
prompt('Name')
end
def prompt_author_details
puts "\n***ENTER AUTHOR DETAILS***\n\n"
first_name = prompt('First name')
second_name = prompt('Second name')
[first_name, second_name]
end
def prompt_label_details
puts "\n***ENTER LABEL DETAILS***\n\n"
title = prompt('Title')
color = prompt('color')
[title, color]
end
def prompt(data_item)
print "#{data_item}: "
gets.chomp
end
end