Skip to content

Commit

Permalink
Fix linter: extend used outside of class or module
Browse files Browse the repository at this point in the history
  • Loading branch information
aamir-asaram committed Sep 4, 2023
1 parent 6c577d9 commit ee97f2a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 53 deletions.
15 changes: 13 additions & 2 deletions main.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
require_relative 'school_library/app'
require_relative 'school_library/modules/display_menu'
def main
App.run
end

def display_menu
puts "\nPlease choose an option by enter a number:"
puts '1. 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 (by ID)'
puts '7. Exit'
print 'Enter your choice: '
gets.chomp.to_i
end

def handle_choice(choice)
extend DisplayMenu
case choice
when 1
list_books
Expand Down
10 changes: 2 additions & 8 deletions school_library/app.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
require_relative 'modules/display_menu'
require_relative 'modules/create_persons'
require_relative 'modules/create_books'
require_relative 'modules/lists'

class App
extend DisplayMenu
extend CreatePerson
extend CreateBook
extend Lists

def self.run
loop do
display_menu
choice = gets.chomp.to_i
handle_choice(choice)
break if choice == 7
end
choice = handle_choice(choice) while choice != 7
puts 'Thanks for using the School Library!'
end
end
43 changes: 0 additions & 43 deletions school_library/modules/display_menu.rb

This file was deleted.

0 comments on commit ee97f2a

Please sign in to comment.