class Object

Public Instance Methods

display_again() click to toggle source
# File lib/cli.rb, line 106
      def display_again 
        puts "Would you like to see the menu again? [y/n]"
        answer = gets.strip.downcase

          if answer == "y"
            puts "Here you go!"
            puts " "
            puts " "
            menu

          elsif answer == "n" || answer == "exit"
            exit_program
          else 
            puts " "
            puts "Uh-oh! Please try again."
            puts " "

      end  

end
display_coffee(index) click to toggle source
# File lib/cli.rb, line 88
def display_coffee(index)
  bean = CoffeeBreak::Beans.all[index]
  CoffeeBreak::Scraper.new.scrape_details(bean)

  puts " "
  puts "You chose:"
  puts " "
  puts "#{bean.name}" 
  puts " "
  puts "#{bean.label}"
  puts " "
  puts "#{bean.price}"
  puts " "
  puts "#{bean.details}"
  puts " "

end
list_options() click to toggle source
# File lib/cli.rb, line 80
def list_options
  CoffeeBreak::Beans.all.each_with_index do |product, index| 
    # Products are listed in numerical order with product name.
    puts "#{index+1} #{product.name}"
    # Data obtained from scrape method displays the name of "product" by order.
  end
end