class CLI
Public Class Methods
new()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 4 def initialize Scraper.scrape_drinks end
Public Instance Methods
call()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 9 def call greeting puts "\nType 'list' to see a list of espresso beverages.\n\n** alternatively, for the lactose challenged, type 'milk' or 'no milk' to see drinks that both will and won't give you indigestion **" puts"\n --> enter 'list', 'milk', or 'no milk' to caffeinate and 'exit' to leave <--".colorize(:color => :light_blue, :background => :white) menu_main end
doesnt_exist()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 440 def doesnt_exist puts "\nLooks like that drink doesn't exist yet! Try again, captain.".colorize(:light_red) end
drink_details(drink)
click to toggle source
# File lib/coffee_drinks/cli.rb, line 409 def drink_details (drink) puts "\nOrder up! One #{drink.name}:" puts "\n#{drink.description}" puts "\n#{drink.ratio}" puts "#{drink.cup}" puts "Milk: #{drink.milk}" end
greeting()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 431 def greeting puts "Hello! And welcome to the Bevvie Bevy: an interactive experience for coffee connoisseurs and novices alike.".colorize(:color => :cyan, :background => :black) puts"\nHave you ever wondered what the difference is between a flat white and long black? If so, the Bevy is here to help." end
list_drinks()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 388 def list_drinks Drink.all.sort_by {|drink| drink.name}.tap{|drink| drink.each.with_index(1) { |drink, i| puts "#{i}. #{drink.name}"}} end
list_pastries()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 400 def list_pastries Pastry.all.sort_by {|pastry| pastry.name}.tap{|pastry| pastry.each.with_index(1) { |pastry, i| puts "#{i}. #{pastry.name}"}} end
list_teas()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 404 def list_teas Tea.all.sort_by {|tea| tea.name}.tap{|tea| tea.each.with_index(1) { |tea, i| puts "#{i}. #{tea.name}"}} end
milk_drinks()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 392 def milk_drinks Drink.milk.sort_by {|drink| drink.name}.tap{|drink| drink.each.with_index(1) { |drink, i| puts "#{i}. #{drink.name}"}} end
no_milk_drinks()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 396 def no_milk_drinks Drink.no_milk.sort_by {|drink| drink.name}.tap{|drink| drink.each.with_index(1) { |drink, i| puts "#{i}. #{drink.name}"}} end
pastry_details(pastry)
click to toggle source
# File lib/coffee_drinks/cli.rb, line 424 def pastry_details (pastry) puts "\nOrder up! One #{pastry.name}:" puts "\n#{pastry.description}" end
psych()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 444 def psych puts "\nHow about a cup of tea before you go (y / n)?".colorize(:magenta) end
tea_details(tea)
click to toggle source
# File lib/coffee_drinks/cli.rb, line 417 def tea_details (tea) puts "\nOrder up! One #{tea.name}:" puts "\n#{tea.description}" puts "\n#{tea.flavor}" puts "\n#{tea.varieties}" end
try_again_boost()
click to toggle source
# File lib/coffee_drinks/cli.rb, line 436 def try_again_boost puts "\nLooks like you need a boost of caffeine! Give it another go, we didn't quite catch that.".colorize(:light_red) end