Last active
January 7, 2018 21:36
-
-
Save Sihui/f50fe86a5ad58fc97df3cb0e248cc0c6 to your computer and use it in GitHub Desktop.
Design Pattern: Prototype and Pizza
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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