-
-
Save Sutto/968195 to your computer and use it in GitHub Desktop.
Revisions
-
Sutto revised this gist
May 12, 2011 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ class Decorator def initialize(decorated) @decorated = decorated end def method_missing(method, *args, &blk) @decorated.send(method, *args, &blk) end end module Decoratable -
thomasfedb created this gist
May 12, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ 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