class Pizza

Constants

CHEESES
CRUSTS
SAUCES
TOPPINGS

Attributes

cheese[R]
crust[R]
sauce[R]
toppings[R]

Public Class Methods

generate(quantity=2) click to toggle source
# File lib/pizza-generator.rb, line 17
def self.generate(quantity=2)
  
  toppings = Pizza.toppings(quantity)
  cheese = Pizza.cheese
  sauce = Pizza.sauce
  crust = Pizza.crust

  Pizza.new(toppings, cheese, sauce, crust)

end
new(toppings, cheese, sauce, crust) click to toggle source
# File lib/pizza-generator.rb, line 10
def initialize(toppings, cheese, sauce, crust)
  @toppings = toppings
  @cheese = cheese 
  @sauce = sauce
  @crust = crust
end

Private Class Methods

cheese() click to toggle source
# File lib/pizza-generator.rb, line 46
def cheese 
  CHEESES.sample
end
crust() click to toggle source
# File lib/pizza-generator.rb, line 54
def crust 
  CRUSTS.sample
end
sauce() click to toggle source
# File lib/pizza-generator.rb, line 50
def sauce 
  SAUCES.sample
end
toppings(quantity) click to toggle source
# File lib/pizza-generator.rb, line 42
def toppings(quantity)
  TOPPINGS.sample(quantity)
end

Public Instance Methods

ingredients() click to toggle source
# File lib/pizza-generator.rb, line 28
def ingredients
  pizza_hash = {
    toppings: @toppings,
    cheese: @cheese,
    sauce: @sauce,
    crust: @crust
  }

  return pizza_hash
end