Class: FreeArtExhibits::CLI
- Inherits:
-
Object
- Object
- FreeArtExhibits::CLI
- Defined in:
- lib/free_art_exhibits/cli.rb
Instance Method Summary collapse
- #call ⇒ Object
- #print_exhibit(exhibit) ⇒ Object
- #print_exhibits(from_number) ⇒ Object
- #start ⇒ Object
Instance Method Details
#call ⇒ Object
2 3 4 5 6 |
# File 'lib/free_art_exhibits/cli.rb', line 2 def call FreeArtExhibits::Scraper.new.make_exhibits puts "Here are some free art exhibits according to Timeout New York" start end |
#print_exhibit(exhibit) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/free_art_exhibits/cli.rb', line 31 def print_exhibit(exhibit) puts "" puts "----------- #{exhibit.title}" puts "" puts "Description: #{exhibit.description}" puts "" puts "" puts "Website: #{exhibit.url}" puts "" puts "" puts "" puts "" puts "Venue: #{exhibit.venue_name}" puts "" puts "" puts "Address: #{exhibit.address}" puts "" puts "" puts "Opening Hours: #{exhibit.opening_hours}" end |
#print_exhibits(from_number) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/free_art_exhibits/cli.rb', line 52 def print_exhibits(from_number) puts "" puts "---------- Exhibits #{from_number} - #{from_number+4} ----------" puts "" FreeArtExhibits::Exhibit.all[from_number-1, 5].each.with_index(from_number) do |exhibit, index| puts "#{index}. #{exhibit.title} - #{exhibit.url}" end end |
#start ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/free_art_exhibits/cli.rb', line 8 def start puts "What exhibit number range would you like to see? Please enter 1 for 1-5 or 6 for 6-10" input = gets.strip.to_i print_exhibits(input) puts "Which number exhibit would you like more info on?" input = gets.strip.to_i exhibit = FreeArtExhibits::Exhibit.find(input) print_exhibit(exhibit) puts "" puts "Would you like to see another exhibit? Enter Y or N" input = gets.strip.downcase if input == "y" start else puts "" puts "Thankyou! Have a great day!" exit end end |