Last active
September 29, 2018 03:55
-
-
Save rachidcalazans/6d2cf4f66362ed6d70ca86e3934c8d1d to your computer and use it in GitHub Desktop.
Design Patterns in Ruby - Template Method
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 CaffeineBeverage | |
def prepare_recipe | |
boil_water | |
brew_condiments # new method | |
add_aditional_condiments # new method | |
pour_in_cup | |
end | |
private | |
def brew_condiments; end # Abstract method | |
def add_aditional_condiments; end # Abstract method | |
def boil_water | |
puts 'boil water' | |
end | |
def pour_in_cup | |
puts 'pour in cup' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment