Created
August 6, 2012 10:06
-
-
Save workmad3/3273137 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 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