Skip to content

Instantly share code, notes, and snippets.

@martinos
Created March 10, 2010 23:25
Show Gist options
  • Save martinos/328585 to your computer and use it in GitHub Desktop.
Save martinos/328585 to your computer and use it in GitHub Desktop.
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