Skip to content

Instantly share code, notes, and snippets.

@Sihui
Last active January 7, 2018 21:36
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/f50fe86a5ad58fc97df3cb0e248cc0c6 to your computer and use it in GitHub Desktop.
Save Sihui/f50fe86a5ad58fc97df3cb0e248cc0c6 to your computer and use it in GitHub Desktop.
Design Pattern: Prototype and Pizza
class Pizza
attr_reader :name, :toppings, :state
def initialize(name, toppings)
@name = name
@toppings = toppings
@state = 'raw'
end
def bake
puts "Baking #{name} ..."
state = 'baked'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment