generated from Saancha/ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3586b14
commit fda8e82
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class Main | ||
|
||
def process_selection(selection) # rubocop:disable Metrics/CyclomaticComplexity | ||
case selection | ||
when '1' | ||
puts "option 1 selected" | ||
when '2' | ||
puts "option 2 selected" | ||
when '3' | ||
puts "option 3 selected" | ||
when '4' | ||
puts "option 4 selected" | ||
when '5' | ||
puts "option 5 selected" | ||
when '6' | ||
puts "option 6 selected" | ||
when '7' | ||
puts "option 7 selected" | ||
when '8' | ||
puts "option 8 selected" | ||
when '9' then "Have a nice day" | ||
else | ||
puts 'Invalid selection' | ||
end | ||
end | ||
|
||
def interface | ||
selection = nil | ||
until selection == '9' | ||
puts "Welcome to Catalog App!\n\n" | ||
puts 'Please choose an option by entering a number:' | ||
puts '1 - List all books' | ||
puts '2 - List all music albums' | ||
puts '3 - List all movies' | ||
puts '4 - List all games' | ||
puts '5 - Create a book' | ||
puts '6 - Create a music album' | ||
puts '7 - Create a movie' | ||
puts '8 - Create a game' | ||
puts '9 - Exit' | ||
selection = gets.chomp.to_s | ||
process_selection(selection) | ||
end | ||
puts "Have a great day!" | ||
end | ||
end | ||
|