Top Level Namespace

Defined Under Namespace

Modules: CoffeeBreak

Instance Method Summary collapse

Instance Method Details

#display_againObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# 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) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# 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_optionsObject



80
81
82
83
84
85
86
# 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