Class: Travel::CLI
- Inherits:
-
Object
- Object
- Travel::CLI
- Defined in:
- lib/travel/cli.rb
Instance Method Summary collapse
- #all_inclusive_resorts ⇒ Object
- #attractions ⇒ Object
- #beaches ⇒ Object
- #call ⇒ Object
- #destinations ⇒ Object
- #destinations_on_the_rise ⇒ Object
- #goodbye ⇒ Object
- #hotels ⇒ Object
- #islands ⇒ Object
- #landmarks ⇒ Object
- #list_awards ⇒ Object
- #menu ⇒ Object
- #museums ⇒ Object
- #restaurants ⇒ Object
Instance Method Details
#all_inclusive_resorts ⇒ Object
68 69 70 71 72 73 |
# File 'lib/travel/cli.rb', line 68 def all_inclusive_resorts Travel::Scraper.scrape_all_inclusive_resorts.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name} - #{winner.location}" end return nil end |
#attractions ⇒ Object
75 76 77 78 79 80 |
# File 'lib/travel/cli.rb', line 75 def attractions Travel::Scraper.scrape_attractions.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name} - #{winner.location}" end return nil end |
#beaches ⇒ Object
82 83 84 85 86 87 |
# File 'lib/travel/cli.rb', line 82 def beaches Travel::Scraper.scrape_beaches.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name} - #{winner.location}, #{winner.best_time}" end return nil end |
#call ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/travel/cli.rb', line 3 def call puts "Welcome to World Travelers'Awards for #{Time.now.year}" list_awards goodbye end |
#destinations ⇒ Object
89 90 91 92 93 94 |
# File 'lib/travel/cli.rb', line 89 def destinations Travel::Scraper.scrape_destinations.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}" end return nil end |
#destinations_on_the_rise ⇒ Object
96 97 98 99 100 101 |
# File 'lib/travel/cli.rb', line 96 def destinations_on_the_rise Travel::Scraper.scrape_destinations_on_the_rise.each.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}" end return nil end |
#goodbye ⇒ Object
64 65 66 |
# File 'lib/travel/cli.rb', line 64 def goodbye puts "Thank you for visiting Travelers Choice Awards. Have a nice day!" end |
#hotels ⇒ Object
103 104 105 106 107 108 |
# File 'lib/travel/cli.rb', line 103 def hotels Travel::Scraper.scrape_hotels.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name} - #{winner.location}" end return nil end |
#islands ⇒ Object
111 112 113 114 115 116 |
# File 'lib/travel/cli.rb', line 111 def islands Travel::Scraper.scrape_islands.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}" end return nil end |
#landmarks ⇒ Object
118 119 120 121 122 123 |
# File 'lib/travel/cli.rb', line 118 def landmarks Travel::Scraper.scrape_landmarks.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}- #{winner.location}" end return nil end |
#list_awards ⇒ Object
11 12 13 14 |
# File 'lib/travel/cli.rb', line 11 def list_awards puts "Please select a category or type exit." @lists = Travel::List.choices_awards end |
#menu ⇒ Object
17 18 19 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 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/travel/cli.rb', line 17 def input = nil puts "Enter the number of the Award you wish to see, list to see the main menu or type exit." while input != "exit" input = gets.strip.downcase case input when "1" puts "All Inclusive Resorts" puts all_inclusive_resorts when "2" puts"Attractions" puts attractions when "3" puts"Beaches" puts beaches when "4" puts"Destinations" puts destinations when "5" puts"Destinations on the Rise" puts destinations_on_the_rise when "6" puts"Hotels" puts hotels when "7" puts"Islands" puts islands when "8" puts"Landmarks" puts landmarks when "9" puts"Museums" puts museums when "10" puts"Restaurants" puts restaurants when "list" list_awards else puts "Please type list or exit" end end end |
#museums ⇒ Object
125 126 127 128 129 130 |
# File 'lib/travel/cli.rb', line 125 def museums Travel::Scraper.scrape_museums.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}- #{winner.location}" end return nil end |
#restaurants ⇒ Object
132 133 134 135 136 137 |
# File 'lib/travel/cli.rb', line 132 def restaurants Travel::Scraper.scrape_restaurants.each.with_index(1) do |winner, index| puts "#{index}: #{winner.name}- #{winner.location} - #{winner.cuisine}" end return nil end |