Skip to content

Instantly share code, notes, and snippets.

@rachidcalazans
Created September 29, 2018 03:37
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 rachidcalazans/9b819a35f0ea68f03c8a60a3d7e19db8 to your computer and use it in GitHub Desktop.
Save rachidcalazans/9b819a35f0ea68f03c8a60a3d7e19db8 to your computer and use it in GitHub Desktop.
Design Patterns in Ruby - Template Method
cappuccino = Cappuccino.new
cappuccino.prepare_recipe
# => boil water
# => brew cappuccino grinds
# => pour in cup
# => add sugar
tea = Tea.new
tea.prepare_recipe
# => boil water
# => steep the bag
# => pour in cup
# => add lemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment