Skip to content

Instantly share code, notes, and snippets.

@workmad3
Last active December 11, 2015 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save workmad3/4619545 to your computer and use it in GitHub Desktop.
Save workmad3/4619545 to your computer and use it in GitHub Desktop.
class HiddenProxy < BasicObject
def initialize(proxy)
@proxy = proxy
end
def method_missing(m, *a, &b)
if m.to_s =~ /^to_(.+)!$/
@proxy = @proxy.send("to_#{$1}", *a, &b)
else
::HiddenProxy.new(@proxy.send(m, *a, &b))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment