Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Created May 14, 2017 09:41
Show Gist options
  • Save kopylovvlad/43a10d4a5095d3be07b01761f4d87152 to your computer and use it in GitHub Desktop.
Save kopylovvlad/43a10d4a5095d3be07b01761f4d87152 to your computer and use it in GitHub Desktop.
class CoffeeMaker
def self.make_coffee(params)
ingredients = {
espresso: params.fetch(:espresso, false),
milk_foam: params.fetch(:milk_foam, false),
whipped_cream: params.fetch(:whipped_cream, false),
steamed_milk: params.fetch(:steamed_milk, false),
chokolate_syrup: params.fetch(:chokolate_syrup, false),
hot_water: params.fetch(:hot_water, false)
}
#
# and some lines of code
#
return cup_of_coffee(ingredients)
end
end
espresso = CoffeeMaker.make_coffee(espresso: true)
espresso_macchiato = CoffeeMaker.make_coffee(espresso: true, milk_foam: true)
espresso_con_panna = CoffeeMaker.make_coffee(espresso: true, whipped_cream: true)
caffe_latte = CoffeeMaker.make_coffee(espresso: true, milk_foam: true, steamed_milk: true)
flat_white = CoffeeMaker.make_coffee(espresso: true, steamed_milk: true)
caffee_mocha = CoffeeMaker.make_coffee(espresso: true, whipped_cream: true, steamed_milk: true, chokolate_syrup: true)
americano = CoffeeMaker.make_coffee(espresso: true, hot_water: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment