Skip to content

Instantly share code, notes, and snippets.

@thomasfedb
Created May 12, 2011 08:47
Show Gist options
  • Save thomasfedb/968188 to your computer and use it in GitHub Desktop.
Save thomasfedb/968188 to your computer and use it in GitHub Desktop.
module Decorator
def initialize(decorated)
@decorated = decorated
end
def method_missing(method, *args)
args.empty? ? @decorated.send(method) : @decorated.send(method, args)
end
end
module Decoratable
def with(decorator)
decorator.new(self)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment