Skip to content

Instantly share code, notes, and snippets.

@Sihui
Last active January 8, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sihui/8cf1a045aca702e1b5a907c76a2431ab to your computer and use it in GitHub Desktop.
Save Sihui/8cf1a045aca702e1b5a907c76a2431ab to your computer and use it in GitHub Desktop.
class PizzaStore
attr_accessor :pizza_prototype_collection
def initialize
@pizza_prototype_collection = {}
end
def take_order(pizza_type)
pizza_prototype = pizza_prototype_collection[pizza_type]
raise 'unsupported pizza type' unless pizza_prototype
pizza = pizza_prototype.clone
pizza.bake
pizza
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment