# File lib/best_reads/cli.rb, line 3defcallstart_menuend
start_menu()click to toggle source
# File lib/best_reads/cli.rb, line 7defstart_menuputs"Welcome to Best Reads!"#First menu loop: lists_menuloopdoputs"Please choose one of our Best-Of Lists"#Scraping best of lists of books and initializing list objectsbest_of_lists = BestReads::Scraper.scrape_best_of_listsBestReads::List.create_and_display_from_collection(best_of_lists)
puts"Please enter a number between 1 and #{best_of_lists.size} or exit to quit".colorize(:color=>:red)
list_number = gets.strip.downcaseif(list_number.to_i.between?(1,best_of_lists.size))
list_url = BestReads::List.find_by_index(list_number.to_i).url#Second menu loop: books_menuloopdobest_of_books = BestReads::Scraper.scrape_books_by_list(list_url.to_s)
BestReads::Book.create_and_display_from_collection(best_of_books)
puts"Press 0 to return to the previous menu, exit to quit or any key to refresh your page".colorize(:color=>:red)
books_menu_input = gets.strip.downcasebreakifbooks_menu_input=="0"returnifbooks_menu_input=="exit"endendbreakiflist_number=="exit"endend