Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created August 6, 2012 10:06
Show Gist options
  • Save workmad3/3273137 to your computer and use it in GitHub Desktop.
Save workmad3/3273137 to your computer and use it in GitHub Desktop.
class ArrayProxy < BasicObject
def initialize(proxy_array)
@proxy_array = proxy_array
end
def <<(arg)
::Kernel.send(:puts, "I'm in ur methodz, playing wiz ur args")
@proxy_array << arg
end
def method_missing(*args, &blk)
@proxy_array.public_send(*args, &blk)
end
end
class Foo
def bar
ArrayProxy.new([])
end
end
Foo.new.bar << "woo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment