Sha256: 0d8665514ccf82abaf19a1236bd36b6766b5de695997de1a053562e22bb57383

Contents?: true

Size: 1.94 KB

Versions: 3

Compression:

Stored size: 1.94 KB

Contents

class VegOut::CLI

  def call
    puts <<~eos

                        ------------------
                        Welcome to Veg Out
                        ------------------

     The best place to find vegan and vegetarian restaurants near you!!

     eos
     start
  end

  def start
    puts ""
    puts "Please enter the name of your city, or a 5 digit zip code:"

    VegOut::Scraper.get_page
  end

  def self.create_list
    puts <<~eos

      ----------------------------------------------
      Here are places with options to eat near you!!
      ----------------------------------------------

    eos

    VegOut::Scraper::restaurants.each_with_index.map {|n, index| puts "#{index+1}. #{n} -- #{VegOut::Scraper::distance[index]} away" }

    self.show_details
  end

  def self.more_info
    puts <<~eos
      If you would like to see the list of restaurants again type 'list'
      To search a new area type 'back' or type 'quit' to exit
    eos

    input = gets.strip
      case input
        when "back"
          VegOut::CLI.new.start
        when "quit"
          exit
        when "list"
          self.create_list
        else
          puts ""
          puts "Not a valid choice!"
          self.more_info
        end
    end

    def self.show_details
      puts ""
      puts "Which restaurant are you interested in learning more about:"
      VegOut::Scraper.find_details_page
    end

    def self.more_details
      VegOut::Scraper.create_restaurant

      VegOut::Scraper::name.size.times {print "~"}
      puts ""
      puts VegOut::Scraper::name
      VegOut::Scraper::name.size.times {print "~"}
      puts ""
      puts VegOut::Scraper::description
      puts ""
      puts "Contact Info:"
      puts VegOut::Scraper::phone
      puts ""
      puts "Location:"
      puts VegOut::Scraper::address
      puts ""
      self.more_info
    end

    def self.retry
      puts ""
      puts "No nearby restaurants! Sorry!"
      VegOut::CLI.new.start
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veg_out-0.2.3 lib/veg_out/cli.rb
veg_out-0.2.2 lib/veg_out/cli.rb
veg_out-0.2.1 veg_out/lib/veg_out/cli.rb