Instantly share code, notes, and snippets.

Embed
What would you like to do?
Design Pattern: Decorator and Waffle
class StrawberryWaffle
attr_reader :waffle
attr_accessor :topping
def initialize(waffle)
@waffle = waffle
@topping = 'strawberries'
end
def serve
waffle.serve
puts " topped with #{topping}"
end
def eat
waffle.eat
puts " and then eat some #{topping}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment