Class: Roadfood::CLI
- Inherits:
-
Object
- Object
- Roadfood::CLI
- Defined in:
- lib/roadfood/cli.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/roadfood/cli.rb', line 3 def call Roadfood::Scraper.new.make_reviews # binding.pry puts "" puts "Welcome to the latest reviews from Roadfood.com." start end |
#print_list ⇒ Object
35 36 37 38 39 |
# File 'lib/roadfood/cli.rb', line 35 def print_list Roadfood::Review.all.each.with_index(1) do |review, index| puts "#{index}. #{review.name} – #{review.city}, #{review.state}" end end |
#print_review(review) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/roadfood/cli.rb', line 41 def print_review(review) puts "" puts "------------ #{review.name} - #{review.city}, #{review.state} ------------" puts "" puts "Rating: #{review.}" puts "Dishes to Try: #{review.dishes_to_try}" puts "Address: #{review.address}" puts "Restaurant Website: #{review.website}" puts "Author: #{review.}" puts "Date Published: #{review.date_published}" puts "" puts "Review:" puts "#{review.body}" puts "" puts "------------------------------------------------------------------" end |
#start ⇒ Object
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/roadfood/cli.rb', line 11 def start puts "" print_list puts"" puts "What review would you like to see?" input = gets.strip review = Roadfood::Review.find(input.to_i) print_review(review) puts "" puts "Would you like to see another review? (y/n)" input = gets.strip.downcase if input == "y" puts "" start else puts "Ok, have a nice day!" exit end end |