Created
March 10, 2010 23:25
-
-
Save martinos/328585 to your computer and use it in GitHub Desktop.
This file contains 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 characters
class BlankSlate | |
instance_methods.each { |m| undef_method m unless m =~ /^__/ } | |
end | |
class MyProxy < BlankSlate | |
def initialize(obj, &proc) | |
@proc = proc | |
@obj = obj | |
end | |
def method_missing(sym, *args, &block) | |
@proc.call(@obj,sym, *args) | |
@obj.__send__(sym, *args, &block) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment