Skip to content

Instantly share code, notes, and snippets.

@Sihui
Last active December 20, 2017 16:53
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/cf3e5beb61f96cd6409fa7a3012151d3 to your computer and use it in GitHub Desktop.
Save Sihui/cf3e5beb61f96cd6409fa7a3012151d3 to your computer and use it in GitHub Desktop.
Design Pattern: Template Method and Chipotle
require 'date'
class DietOrderSihui < DietOrder
def vessel
Bowl
end
def meat
Steak
end
def is_cheat_day?
Date.today.day == 10
end
end
class DietOrderAmber < DietOrder
def vessel
Burrito
end
def meat
Chicken
end
def is_cheat_day?
Date.today.day == 25
end
end
@mrcreel
Copy link

mrcreel commented Dec 20, 2017

Line 5 should be Bowl not Bowel
Bowel is funnier, but...

@Sihui
Copy link
Author

Sihui commented Dec 20, 2017

Thanks for pointing out, Michael!
Updated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment