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
|
# File 'lib/best_reads/cli.rb', line 7
def
puts "Welcome to Best Reads!"
loop do
puts "Please choose one of our Best-Of Lists"
best_of_lists = BestReads::Scraper.scrape_best_of_lists
BestReads::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.downcase
if(list_number.to_i.between?(1,best_of_lists.size))
list_url = BestReads::List.find_by_index(list_number.to_i).url
loop do
best_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)
= gets.strip.downcase
break if =="0"
return if =="exit"
end
end
break if list_number == "exit"
end
end
|