-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Refactor code: move input choice functionality to main.rb"
This reverts commit c0be0bd.
- Loading branch information
1 parent
e7f4bfb
commit 6c577d9
Showing
3 changed files
with
63 additions
and
33 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 |
---|---|---|
@@ -1,36 +1,34 @@ | ||
require_relative 'school_library/app' | ||
require_relative 'school_library/modules/display_menu' | ||
class Main | ||
def main | ||
App.run | ||
end | ||
def main | ||
App.run | ||
end | ||
|
||
def handle_choice(choice) | ||
extend DisplayMenu | ||
case choice | ||
when 1 | ||
list_books | ||
when 2 | ||
list_people | ||
when 3 | ||
create_person | ||
when 4 | ||
create_book | ||
when 5 | ||
create_rental | ||
when 6 | ||
print 'Enter person ID: ' | ||
person_id = gets.chomp.to_i | ||
list_rentals_for_person(person_id) | ||
else | ||
invalid_choice | ||
end | ||
display_menu | ||
def handle_choice(choice) | ||
extend DisplayMenu | ||
case choice | ||
when 1 | ||
list_books | ||
when 2 | ||
list_people | ||
when 3 | ||
create_person | ||
when 4 | ||
create_book | ||
when 5 | ||
create_rental | ||
when 6 | ||
print 'Enter person ID: ' | ||
person_id = gets.chomp.to_i | ||
list_rentals_for_person(person_id) | ||
else | ||
invalid_choice | ||
end | ||
display_menu | ||
end | ||
|
||
def invalid_choice | ||
puts 'Invalid choice. Please enter a valid option (1-7).' | ||
end | ||
def invalid_choice | ||
puts 'Invalid choice. Please enter a valid option (1-7).' | ||
end | ||
|
||
Main.new.main | ||
main if __FILE__ == $PROGRAM_NAME |
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
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