class BalboaParkItineraryIdeas::CLI

The CLI Controller - responsible for business logic/user interactions

Public Instance Methods

call() click to toggle source
# File lib/balboa_park_itinerary_ideas/cli.rb, line 4
def call
  @s = BalboaParkItineraryIdeas::Scraper.new
  @s.scrape_itineraries
  @welcome_header = @s.scrape_welcome_header
  @welcome_message = @s.scrape_welcome_message
  @header = @s.scrape_header

  start
end
goodbye() click to toggle source

displays exit message to the user

# File lib/balboa_park_itinerary_ideas/cli.rb, line 87
def goodbye
  puts "\nGoodbye! Comeback soon!\n".green.bold
end
list_itineraries() click to toggle source

lists the itineraries for the user to choose from

# File lib/balboa_park_itinerary_ideas/cli.rb, line 31
def list_itineraries
  puts "\n#{@header}".blue.bold

  BalboaParkItineraryIdeas::Itinerary.all.each.with_index(1) do |itinerary, i|
    puts "#{i}.".red.bold + " #{itinerary.title}".bold
  end
end
menu() click to toggle source

displays the user's choices, gets the user's input, and either displays details of an itinerary, the list of itineraries, or exits

print_details(itinerary) click to toggle source

displays the itinerary's details: title, summary, and each attraction's name, description, and URL (if has one)

start() click to toggle source
# File lib/balboa_park_itinerary_ideas/cli.rb, line 14
def start
  welcome_message
  list_itineraries
  menu
end
welcome_message() click to toggle source

displays scraped welome header and message

# File lib/balboa_park_itinerary_ideas/cli.rb, line 21
def welcome_message
  @border = "------------------------------------------------------------------------------"

  puts @border
  puts "#{@welcome_header}".blue.bold
  puts Strings.wrap(@welcome_message, 80)
  puts @border
end