Skip to content

Instantly share code, notes, and snippets.

@meaganewaller
Created January 1, 2015 01:45
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 meaganewaller/a84e7a4c971316f3bbd4 to your computer and use it in GitHub Desktop.
Save meaganewaller/a84e7a4c971316f3bbd4 to your computer and use it in GitHub Desktop.
The Decorator Pattern
w = SimpleWriter.new('out')
class << w
alias old_write_line write_line
def write_line(line)
old_write_line("#{Time.new}: #{line}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment