Last active
July 14, 2017 15:16
-
-
Save Sihui/29b823ef949562b48511d610cc8af838 to your computer and use it in GitHub Desktop.
Design Pattern: Template Method and Chipotle Raw
This file contains 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 DietOrderSihui | |
def vessel | |
Bowl | |
end | |
def meat | |
Steak | |
end | |
def toppings | |
Tomato | |
end | |
def extras | |
nil | |
end | |
def order | |
meal = vessel | |
meal << meat | |
meal << toppings | |
meal << extras | |
meal | |
end | |
end | |
class DietOrderAmber | |
def vessel | |
Burrito | |
end | |
def meat | |
Chicken | |
end | |
def toppings | |
Tomato | |
end | |
def extras | |
nil | |
end | |
def order | |
meal = vessel | |
meal << meat | |
meal << toppings | |
meal << extras | |
meal | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment