20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/cat_adoption/cli.rb', line 20
def selection
loop do
puts " "
puts "Please select the number of the cat you would like to learn about or type in \"cats\" to see the list again or type \"exit\" to leave:"
input = gets.strip.downcase
if input.to_i > 0 && input.to_i <= @cats.count
cat = @cats[input.to_i - 1]
CatAdoption::Scraper.scrape_bio_page(cat)
puts " "
puts "#{cat.number_label} #{cat.number}"
puts "#{cat.breed_label} #{cat.breed}"
puts "#{cat.sex_label} #{cat.sex}"
puts "#{cat.dob_label} #{cat.dob}"
puts "#{cat.age_label} #{cat.age}"
puts "#{cat.weight_label} #{cat.weight}"
puts "#{cat.color_label} #{cat.color}"
puts "#{cat.location_label} #{cat.location}"
puts "#{cat.fee_label} #{cat.fee}"
puts "#{cat.description}"
elsif input == "exit"
return
elsif input == "cats"
show_list
else
puts " "
puts "Invalid choice. Please type in either \"cats\" or \"exit.\""
end
end
end
|